• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ColognePhonetic类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Colour类代码示例发布时间:2022-05-22
下一篇:
Java MessagePostProcessor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap