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>
目录的位置。
否则会出错