本文整理汇总了Java中org.apache.lucene.analysis.cjk.CJKWidthFilter类的典型用法代码示例。如果您正苦于以下问题:Java CJKWidthFilter类的具体用法?Java CJKWidthFilter怎么用?Java CJKWidthFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CJKWidthFilter类属于org.apache.lucene.analysis.cjk包,在下文中一共展示了CJKWidthFilter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testKatakanaReadingsHalfWidth
import org.apache.lucene.analysis.cjk.CJKWidthFilter; //导入依赖的package包/类
public void testKatakanaReadingsHalfWidth() throws IOException {
Analyzer a = new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
Tokenizer tokenizer = new JapaneseTokenizer(newAttributeFactory(), reader, null, true, JapaneseTokenizer.Mode.SEARCH);
TokenStream stream = new CJKWidthFilter(tokenizer);
return new TokenStreamComponents(tokenizer, new JapaneseReadingFormFilter(stream, false));
}
};
assertAnalyzesTo(a, "今夜はロバート先生と話した",
new String[] { "コンヤ", "ハ", "ロバート", "センセイ", "ト", "ハナシ", "タ" }
);
}
示例2: testRomajiReadingsHalfWidth
import org.apache.lucene.analysis.cjk.CJKWidthFilter; //导入依赖的package包/类
public void testRomajiReadingsHalfWidth() throws IOException {
Analyzer a = new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
Tokenizer tokenizer = new JapaneseTokenizer(newAttributeFactory(), reader, null, true, JapaneseTokenizer.Mode.SEARCH);
TokenStream stream = new CJKWidthFilter(tokenizer);
return new TokenStreamComponents(tokenizer, new JapaneseReadingFormFilter(stream, true));
}
};
assertAnalyzesTo(a, "今夜はロバート先生と話した",
new String[] { "kon'ya", "ha", "robato", "sensei", "to", "hanashi", "ta" }
);
}
示例3: testKatakanaReadingsHalfWidth
import org.apache.lucene.analysis.cjk.CJKWidthFilter; //导入依赖的package包/类
public void testKatakanaReadingsHalfWidth() throws IOException {
Analyzer a = new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
Tokenizer tokenizer = new JapaneseTokenizer(reader, null, true, JapaneseTokenizer.Mode.SEARCH);
TokenStream stream = new CJKWidthFilter(tokenizer);
return new TokenStreamComponents(tokenizer, new JapaneseReadingFormFilter(stream, false));
}
};
assertAnalyzesTo(a, "今夜はロバート先生と話した",
new String[] { "コンヤ", "ハ", "ロバート", "センセイ", "ト", "ハナシ", "タ" }
);
}
示例4: testRomajiReadingsHalfWidth
import org.apache.lucene.analysis.cjk.CJKWidthFilter; //导入依赖的package包/类
public void testRomajiReadingsHalfWidth() throws IOException {
Analyzer a = new Analyzer() {
@Override
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
Tokenizer tokenizer = new JapaneseTokenizer(reader, null, true, JapaneseTokenizer.Mode.SEARCH);
TokenStream stream = new CJKWidthFilter(tokenizer);
return new TokenStreamComponents(tokenizer, new JapaneseReadingFormFilter(stream, true));
}
};
assertAnalyzesTo(a, "今夜はロバート先生と話した",
new String[] { "kon'ya", "ha", "robato", "sensei", "to", "hanashi", "ta" }
);
}
示例5: create
import org.apache.lucene.analysis.cjk.CJKWidthFilter; //导入依赖的package包/类
@Override
public TokenStream create(TokenStream tokenStream) {
return new CJKWidthFilter(tokenStream);
}
示例6: create
import org.apache.lucene.analysis.cjk.CJKWidthFilter; //导入依赖的package包/类
@Override
public TokenStream create(TokenStream input) {
return new CJKWidthFilter(input);
}