本文整理汇总了Java中org.apache.lucene.analysis.ja.util.DictionaryBuilder.DictionaryFormat类的典型用法代码示例。如果您正苦于以下问题:Java DictionaryFormat类的具体用法?Java DictionaryFormat怎么用?Java DictionaryFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DictionaryFormat类属于org.apache.lucene.analysis.ja.util.DictionaryBuilder包,在下文中一共展示了DictionaryFormat类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatEntry
import org.apache.lucene.analysis.ja.util.DictionaryBuilder.DictionaryFormat; //导入依赖的package包/类
public String[] formatEntry(String[] features) {
if (this.format == DictionaryFormat.IPADIC) {
return features;
} else {
String[] features2 = new String[13];
features2[0] = features[0];
features2[1] = features[1];
features2[2] = features[2];
features2[3] = features[3];
features2[4] = features[4];
features2[5] = features[5];
features2[6] = features[6];
features2[7] = features[7];
features2[8] = features[8];
features2[9] = features[9];
features2[10] = features[11];
// If the surface reading is non-existent, use surface form for reading and pronunciation.
// This happens with punctuation in UniDic and there are possibly other cases as well
if (features[13].length() == 0) {
features2[11] = features[0];
features2[12] = features[0];
} else {
features2[11] = features[13];
features2[12] = features[13];
}
return features2;
}
}
示例2: TokenInfoDictionaryBuilder
import org.apache.lucene.analysis.ja.util.DictionaryBuilder.DictionaryFormat; //导入依赖的package包/类
public TokenInfoDictionaryBuilder(DictionaryFormat format, String encoding, boolean normalizeEntries) {
this.format = format;
this.encoding = encoding;
this.normalizeEntries = normalizeEntries;
this.normalizer = normalizeEntries ? Normalizer2.getInstance(null, "nfkc", Normalizer2.Mode.COMPOSE) : null;
}