当前位置: 首页>>代码示例>>Java>>正文


Java Caverphone2类代码示例

本文整理汇总了Java中org.apache.commons.codec.language.Caverphone2的典型用法代码示例。如果您正苦于以下问题:Java Caverphone2类的具体用法?Java Caverphone2怎么用?Java Caverphone2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Caverphone2类属于org.apache.commons.codec.language包,在下文中一共展示了Caverphone2类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import org.apache.commons.codec.language.Caverphone2; //导入依赖的package包/类
@Override
public TokenStream create(TokenStream tokenStream) {
	if (BEIDER_MORSE.equals(codec))
		return new BeiderMorseTokenFilter(tokenStream, new EncoderKey(
				ruleType, maxPhonemes));
	if (COLOGNE_PHONETIC.equals(codec))
		return new EncoderTokenFilter(tokenStream, new ColognePhonetic());
	if (SOUNDEX.equals(codec))
		return new EncoderTokenFilter(tokenStream, new Soundex());
	if (REFINED_SOUNDEX.equals(codec))
		return new EncoderTokenFilter(tokenStream, new RefinedSoundex());
	if (METAPHONE.equals(codec))
		return new EncoderTokenFilter(tokenStream, new Metaphone());
	if (CAVERPHONE1.equals(codec))
		return new EncoderTokenFilter(tokenStream, new Caverphone1());
	if (CAVERPHONE2.equals(codec))
		return new EncoderTokenFilter(tokenStream, new Caverphone2());
	return null;
}
 
开发者ID:jaeksoft,项目名称:opensearchserver,代码行数:20,代码来源:PhoneticFilter.java

示例2: testFactoryReflectionCaverphone2

import org.apache.commons.codec.language.Caverphone2; //导入依赖的package包/类
/** 
 * we use "Caverphone2" as it is registered in the REGISTRY as Caverphone,
 * so this effectively tests reflection without package name
 */
public void testFactoryReflectionCaverphone2() throws IOException {
  Map<String,String> args = new HashMap<>();
  args.put(PhoneticFilterFactory.ENCODER, "Caverphone2");
  PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
  factory.inform(new ClasspathResourceLoader(factory.getClass()));
  assertTrue(factory.getEncoder() instanceof Caverphone2);
  assertTrue(factory.inject); // default
}
 
开发者ID:europeana,项目名称:search,代码行数:13,代码来源:TestPhoneticFilterFactory.java

示例3: testFactoryReflectionCaverphone

import org.apache.commons.codec.language.Caverphone2; //导入依赖的package包/类
public void testFactoryReflectionCaverphone() throws IOException {
  Map<String,String> args = new HashMap<>();
  args.put(PhoneticFilterFactory.ENCODER, "Caverphone");
  PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
  factory.inform(new ClasspathResourceLoader(factory.getClass()));
  assertTrue(factory.getEncoder() instanceof Caverphone2);
  assertTrue(factory.inject); // default
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:TestPhoneticFilterFactory.java

示例4: testFactoryCaseReflection

import org.apache.commons.codec.language.Caverphone2; //导入依赖的package包/类
/**
 * Case: Reflection
 */
public void testFactoryCaseReflection() throws IOException {
  Map<String,String> args = new HashMap<String, String>();
  
  PhoneticFilterFactory ff = new PhoneticFilterFactory();
  ClasspathResourceLoader loader = new ClasspathResourceLoader(ff.getClass());

  args.put( PhoneticFilterFactory.ENCODER, "org.apache.commons.codec.language.Metaphone" );
  ff.init( args );
  ff.inform( loader );
  assertTrue( ff.getEncoder() instanceof Metaphone );
  assertTrue( ff.inject ); // default

  // we use "Caverphone2" as it is registered in the REGISTRY as Caverphone,
  // so this effectively tests reflection without package name
  args.put( PhoneticFilterFactory.ENCODER, "Caverphone2" );
  ff.init( args );
  ff.inform( loader );
  assertTrue( ff.getEncoder() instanceof Caverphone2 );
  assertTrue( ff.inject ); // default
  
  // cross check with registry
  args.put( PhoneticFilterFactory.ENCODER, "Caverphone" );
  ff.init( args );
  ff.inform( loader );
  assertTrue( ff.getEncoder() instanceof Caverphone2 );
  assertTrue( ff.inject ); // default
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:31,代码来源:TestPhoneticFilterFactory.java

示例5: testFactoryReflectionCaverphone2

import org.apache.commons.codec.language.Caverphone2; //导入依赖的package包/类
/** 
 * we use "Caverphone2" as it is registered in the REGISTRY as Caverphone,
 * so this effectively tests reflection without package name
 */
public void testFactoryReflectionCaverphone2() throws IOException {
  Map<String,String> args = new HashMap<String, String>();
  args.put(PhoneticFilterFactory.ENCODER, "Caverphone2");
  PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
  factory.inform(new ClasspathResourceLoader(factory.getClass()));
  assertTrue(factory.getEncoder() instanceof Caverphone2);
  assertTrue(factory.inject); // default
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:13,代码来源:TestPhoneticFilterFactory.java

示例6: testFactoryReflectionCaverphone

import org.apache.commons.codec.language.Caverphone2; //导入依赖的package包/类
public void testFactoryReflectionCaverphone() throws IOException {
  Map<String,String> args = new HashMap<String, String>();
  args.put(PhoneticFilterFactory.ENCODER, "Caverphone");
  PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
  factory.inform(new ClasspathResourceLoader(factory.getClass()));
  assertTrue(factory.getEncoder() instanceof Caverphone2);
  assertTrue(factory.inject); // default
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:9,代码来源:TestPhoneticFilterFactory.java

示例7: PhoneticTokenFilterFactory

import org.apache.commons.codec.language.Caverphone2; //导入依赖的package包/类
public PhoneticTokenFilterFactory(IndexSettings indexSettings, Environment environment, String name, Settings settings) {
    super(indexSettings, name, settings);
    this.languageset = null;
    this.nametype = null;
    this.ruletype = null;
    this.maxcodelength = 0;
    this.replace = settings.getAsBooleanLenientForPreEs6Indices(indexSettings.getIndexVersionCreated(), "replace", true, deprecationLogger);
    // weird, encoder is null at last step in SimplePhoneticAnalysisTests, so we set it to metaphone as default
    String encodername = settings.get("encoder", "metaphone");
    if ("metaphone".equalsIgnoreCase(encodername)) {
        this.encoder = new Metaphone();
    } else if ("soundex".equalsIgnoreCase(encodername)) {
        this.encoder = new Soundex();
    } else if ("caverphone1".equalsIgnoreCase(encodername)) {
        this.encoder = new Caverphone1();
    } else if ("caverphone2".equalsIgnoreCase(encodername)) {
        this.encoder = new Caverphone2();
    } else if ("caverphone".equalsIgnoreCase(encodername)) {
        this.encoder = new Caverphone2();
    } else if ("refined_soundex".equalsIgnoreCase(encodername) || "refinedSoundex".equalsIgnoreCase(encodername)) {
        this.encoder = new RefinedSoundex();
    } else if ("cologne".equalsIgnoreCase(encodername)) {
        this.encoder = new ColognePhonetic();
    } else if ("double_metaphone".equalsIgnoreCase(encodername) || "doubleMetaphone".equalsIgnoreCase(encodername)) {
        this.encoder = null;
        this.maxcodelength = settings.getAsInt("max_code_len", 4);
    } else if ("bm".equalsIgnoreCase(encodername) || "beider_morse".equalsIgnoreCase(encodername) || "beidermorse".equalsIgnoreCase(encodername)) {
        this.encoder = null;
        this.languageset = settings.getAsArray("languageset");
        String ruleType = settings.get("rule_type", "approx");
        if ("approx".equalsIgnoreCase(ruleType)) {
            ruletype = RuleType.APPROX;
        } else if ("exact".equalsIgnoreCase(ruleType)) {
            ruletype = RuleType.EXACT;
        } else {
            throw new IllegalArgumentException("No matching rule type [" + ruleType + "] for beider morse encoder");
        }
        String nameType = settings.get("name_type", "generic");
        if ("GENERIC".equalsIgnoreCase(nameType)) {
            nametype = NameType.GENERIC;
        } else if ("ASHKENAZI".equalsIgnoreCase(nameType)) {
            nametype = NameType.ASHKENAZI;
        } else if ("SEPHARDIC".equalsIgnoreCase(nameType)) {
            nametype = NameType.SEPHARDIC;
        }
    } else if ("koelnerphonetik".equalsIgnoreCase(encodername)) {
        this.encoder = new KoelnerPhonetik();
    } else if ("haasephonetik".equalsIgnoreCase(encodername)) {
        this.encoder = new HaasePhonetik();
    } else if ("nysiis".equalsIgnoreCase(encodername)) {
        this.encoder = new Nysiis();
    } else if ("daitch_mokotoff".equalsIgnoreCase(encodername)) {
        this.encoder = new DaitchMokotoffSoundex();
    } else {
        throw new IllegalArgumentException("unknown encoder [" + encodername + "] for phonetic token filter");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:58,代码来源:PhoneticTokenFilterFactory.java


注:本文中的org.apache.commons.codec.language.Caverphone2类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。