当前位置: 首页>>代码示例>>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;未经允许,请勿转载。