zoukankan      html  css  js  c++  java
  • 使用PanGu分词很简单

    private static bool _Inited = true;
            static void Main(string[] args)
            {
                if (_Inited)
                {
                    PanGu.Segment.Init(@"D:\Lucene.Net\df\soo\pg\bin\Debug\PanGu.xml");
                    _Inited = false;
                }
                Segment segment = new Segment();
                ICollection<WordInfo> words = segment.DoSegment("如何防止console程序文本区被选取或者键盘的控制。。我写的程序当鼠标点选文本区的时候会中断运行。。请问如何解决。");
                foreach (WordInfo i in words)
                {
                    Console.WriteLine(i.Rank);
                    Console.WriteLine(i.Frequency);
                    Console.WriteLine(i.OriginalWordType);
                    Console.WriteLine(i.Pos);
                    Console.WriteLine(i.Position);
                    Console.WriteLine(i.Rank);
                    Console.WriteLine(i.Word);
                    Console.WriteLine(i.WordType);
                    Console.WriteLine("========");
                }
                Console.Read();
            }

    注意D:\Lucene.Net\df\soo\pg\bin\Debug\PanGu.xml

    和 PanGu.xml中的 <DictionaryPath>..\Dictionaries</DictionaryPath>

    目录的位置。

    否则会出错

  • 相关阅读:
    数据库锁表及阻塞的原因和解决办法
    JS中的this都有什么用?
    vue打包要点
    Vue.js的虚拟dom
    JS继承方式
    JS中的浅拷贝和深拷贝。
    详解计算机原码,反码,补码。
    经常被问到的面试题1
    eslint规则说明
    git常用命令总结
  • 原文地址:https://www.cnblogs.com/coolwind/p/1629932.html
Copyright © 2011-2022 走看看