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


Java ColognePhonetic类代码示例

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


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

示例1: create

import org.apache.commons.codec.language.ColognePhonetic; //导入依赖的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: DefaultNameService

import org.apache.commons.codec.language.ColognePhonetic; //导入依赖的package包/类
@Inject
    public DefaultNameService(TreeFile treeFile,
                              CreatureNameGenerator creatureNameGenerator,
                              PlayerNameGenerator playerNameGenerator) throws IOException {

        nameGenerators = new HashMap<>();
        nameGenerators.put(NameService.CREATURE, creatureNameGenerator);
        nameGenerators.put(NameService.PLAYER, playerNameGenerator);

        phonetic = new ColognePhonetic();

        fictionalNames =  loadList(this.getClass().getResourceAsStream("/name/fictionalreserved.lst"));
        developersNames =  loadList(this.getClass().getResourceAsStream("/name/developers.lst"));
        profaneWords = new ArrayList<>();

        ResourceBundle bundle = ResourceBundle.getBundle("name.profane");
        for(String word : bundle.keySet()) {
            boolean substringMatch = bundle.getString(word).equalsIgnoreCase("1");
            ProfaneWord newWord = new ProfaneWord(word.toLowerCase(), substringMatch);
            profaneWords.add(newWord);
        }
//
//        final IffReader<DataTable> dataTableReader = new DataTableIffReader();
//        final DataTable dataTable = dataTableReader.read(new ChunkReader("datatables/chat/profanity_filter.iff", treeFile.open("datatables/chat/profanity_filter.iff")));
//
//        for (DataTableRow row : dataTable.getRows()) {
//            String word = row.get(0).getString();
//            boolean substringMatch = row.get(1).getInt() == 1;
//            ProfaneWord newWord = new ProfaneWord(word.toLowerCase(), substringMatch);
//            profaneWords.add(newWord);
//        }
    }
 
开发者ID:bacta,项目名称:swg-old,代码行数:33,代码来源:DefaultNameService.java

示例3: DefaultNameService

import org.apache.commons.codec.language.ColognePhonetic; //导入依赖的package包/类
@Inject
    public DefaultNameService(TreeFile treeFile,
                              CreatureNameGenerator creatureNameGenerator,
                              PlayerNameGenerator playerNameGenerator) throws IOException {

        nameGenerators = new HashMap<>();
        nameGenerators.put(NameService.CREATURE, creatureNameGenerator);
        nameGenerators.put(NameService.PLAYER, playerNameGenerator);

        phonetic = new ColognePhonetic();

        fictionalNames = loadList(this.getClass().getResourceAsStream("/name/fictionalreserved.lst"));
        developersNames = loadList(this.getClass().getResourceAsStream("/name/developers.lst"));
        profaneWords = new ArrayList<>();

        ResourceBundle bundle = ResourceBundle.getBundle("name.profane");
        for (String word : bundle.keySet()) {
            boolean substringMatch = bundle.getString(word).equalsIgnoreCase("1");
            ProfaneWord newWord = new ProfaneWord(word.toLowerCase(), substringMatch);
            profaneWords.add(newWord);
        }
//
//        final IffReader<DataTable> dataTableReader = new DataTableIffReader();
//        final DataTable dataTable = dataTableReader.read(new ChunkReader("datatables/chat/profanity_filter.iff", treeFile.open("datatables/chat/profanity_filter.iff")));
//
//        for (DataTableRow row : dataTable.getRows()) {
//            String word = row.get(0).getString();
//            boolean substringMatch = row.get(1).getInt() == 1;
//            ProfaneWord newWord = new ProfaneWord(word.toLowerCase(), substringMatch);
//            profaneWords.add(newWord);
//        }
    }
 
开发者ID:bacta,项目名称:pre-cu,代码行数:33,代码来源:DefaultNameService.java

示例4: PhoneticTokenFilterFactory

import org.apache.commons.codec.language.ColognePhonetic; //导入依赖的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

示例5: ColognePhoneticKeyer

import org.apache.commons.codec.language.ColognePhonetic; //导入依赖的package包/类
public ColognePhoneticKeyer() {
    _codec = new ColognePhonetic();
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:4,代码来源:ColognePhoneticKeyer.java

示例6: hasSlotIsCologneEqual

import org.apache.commons.codec.language.ColognePhonetic; //导入依赖的package包/类
/**
 * Checks if a slot is contained in the intent request and has a value which is a
 * phonetic sibling of the string given to this method. Cologne phonetic algorithm
 * is optimized for German language and in this case is used to match slot value with
 * value given to this method.
 * @param slotName name of the slot to look after
 * @param value the value
 * @return True, if slot value and given value are phonetically equal with Cologne phonetic algorithm
 */
public boolean hasSlotIsCologneEqual(final String slotName, final String value) {
    final String slotValue = getSlotValue(slotName);
    return hasSlotNotBlank(slotName) && value != null &&
            new ColognePhonetic().isEncodeEqual(slotValue, value);
}
 
开发者ID:KayLerch,项目名称:alexa-skills-kit-tellask-java,代码行数:15,代码来源:AlexaInput.java


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