This article is referenced from: https://blog.csdn.net/mss359681091/article/details/52078147
All file downloads needed in this article contain items:
Create a Windows Forms application with vs2015. When you create a project, remember to change its properties to Console Application. Of course, it can also be the default, just for convenience.As follows
In addition, you need to reference'Lucene.Net.dll'
1. Monary Word Separation
2. Binary Word Separation
On that basis, reference the two.cs files in the folder Analyzers, as shown below
Binary Word Separation/// <summary> /// Lucene CJK Analyzer /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { Analyzer analyzer = new CJKAnalyzer(); // Standard participle → Unary participle TokenStream tokenStream = analyzer.TokenStream("", new StringReader("It's impossible to drink only plain milk - Fireflies in the dark")); Token token = null; while ((token = tokenStream.Next()) != null) // Do not return as long as there are words left null { string word = token.TermText(); // token.TermText() Get the current participle Console.Write(word + " | "); } }