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>

    目录的位置。

    否则会出错

  • 相关阅读:
    定义serialVersionUID的作用与意义整理
    HttpClient学习整理
    Eclipse+TestNG搭建接口自动化测试框架
    Jmeter之Bean shell使用(一)
    吴军博士的《数学之美》(摘录)
    SqlServer—大话函数依赖与范式
    MySQL—FOREIGN KEY
    MYSQL-用户操作
    WAMPServer 默认安装启动后,图标显示橙黄色
    Linux time命令
  • 原文地址:https://www.cnblogs.com/coolwind/p/1629932.html
Copyright © 2011-2022 走看看