當前位置: 首頁>>代碼示例>>Java>>正文


Java DictionaryFormat類代碼示例

本文整理匯總了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;
  }
}
 
開發者ID:europeana,項目名稱:search,代碼行數:30,代碼來源:TokenInfoDictionaryBuilder.java

示例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;
}
 
開發者ID:europeana,項目名稱:search,代碼行數:7,代碼來源:TokenInfoDictionaryBuilder.java


注:本文中的org.apache.lucene.analysis.ja.util.DictionaryBuilder.DictionaryFormat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。