Skip to content

Instantly share code, notes, and snippets.

@nathanchen
Created October 9, 2012 05:36
Show Gist options
  • Select an option

  • Save nathanchen/3856813 to your computer and use it in GitHub Desktop.

Select an option

Save nathanchen/3856813 to your computer and use it in GitHub Desktop.
JAVA - Lucene Fenci Test
public static void main(String[] args) throws IOException
{
Analyzer analyzer = new PaodingAnalyzer();
// String indexString = "被子U盘你平方米包的关于番禺供/电局增加乙类工作票签发人的请示西班牙语能源部九阳兔毛高筒雪地靴";
String indexString = "九阳";
StringReader reader = new StringReader(indexString);
TokenStream ts = analyzer.tokenStream(indexString, reader);
CharTermAttribute charTermAttribute = ts.addAttribute(CharTermAttribute.class);
while (ts.incrementToken()) {
String term = charTermAttribute.toString();
System.out.println(term);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment