本文整理匯總了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;
}