本文整理汇总了Java中org.apache.commons.codec.language.RefinedSoundex类的典型用法代码示例。如果您正苦于以下问题:Java RefinedSoundex类的具体用法?Java RefinedSoundex怎么用?Java RefinedSoundex使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RefinedSoundex类属于org.apache.commons.codec.language包,在下文中一共展示了RefinedSoundex类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的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;
}
示例2: PhoneticCorrection
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的package包/类
public PhoneticCorrection(boolean lookupIfKnown) {
this.lookupIfKnown = lookupIfKnown;
refinedSoundex = new RefinedSoundex();
doubleMetaphone = new DoubleMetaphone();
metaphoneCodes = new HashMap<>();
soundexCodes = new HashMap<>();
}
示例3: doCall
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的package包/类
public Boolean doCall() throws Exception {
MungeStepOutput<String> out = getOut();
MungeStepOutput<String> in = getMSOInputs().get(0);
String data = in.getData();
if (data != null) {
out.setData(new RefinedSoundex().soundex(data));
} else {
out.setData(null);
}
return true;
}
示例4: getEncodedMF
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的package包/类
private String getEncodedMF( String value, Integer algorithmType ) {
String encodedValueMF = "";
switch ( algorithmType ) {
case FuzzyMatchMeta.OPERATION_TYPE_METAPHONE:
encodedValueMF = ( new Metaphone() ).metaphone( value );
break;
case FuzzyMatchMeta.OPERATION_TYPE_DOUBLE_METAPHONE:
encodedValueMF = ( ( new DoubleMetaphone() ).doubleMetaphone( value ) );
break;
case FuzzyMatchMeta.OPERATION_TYPE_SOUNDEX:
encodedValueMF = ( new Soundex() ).encode( value );
break;
case FuzzyMatchMeta.OPERATION_TYPE_REFINED_SOUNDEX:
encodedValueMF = ( new RefinedSoundex() ).encode( value );
break;
default:
break;
}
return encodedValueMF;
}
示例5: PhoneticTokenFilterFactory
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的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");
}
}
示例6: initialize
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的package包/类
@Setup(Level.Trial)
public void initialize()
{
instance = new RefinedSoundex();
}
示例7: doPhonetic
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的package包/类
private Object[] doPhonetic(Object[] row) {
// Reserve room
Object[] rowData = buildEmptyRow();
Iterator<Object[]> it = data.look.iterator();
String lookupValueMF=null;
Object o=row[data.indexOfMainField];
String lookupvalue=(String) o;
lookupValueMF=(new Metaphone()).metaphone(lookupvalue);
while (it.hasNext()){
// Get cached row data
Object[] cachedData = (Object[]) it.next();
// Key value is the first value
String cacheValue= (String) cachedData[0];
String cacheValueMF="";
switch (meta.getAlgorithmType()) {
case FuzzyMatchMeta.OPERATION_TYPE_METAPHONE:
cacheValueMF=(new Metaphone()).metaphone(cacheValue);
break;
case FuzzyMatchMeta.OPERATION_TYPE_DOUBLE_METAPHONE:
cacheValueMF=((new DoubleMetaphone()).doubleMetaphone(cacheValue));
break;
case FuzzyMatchMeta.OPERATION_TYPE_SOUNDEX:
cacheValueMF= (new Soundex()).encode(cacheValue);
break;
case FuzzyMatchMeta.OPERATION_TYPE_REFINED_SOUNDEX:
cacheValueMF=(new RefinedSoundex()).encode(cacheValue);
break;
default:
break;
}
if(lookupValueMF.equals(cacheValueMF)) {
// Add match value
int index=0;
rowData[index++]=cacheValue;
// Add metric value?
if(data.addValueFieldName) {
rowData[index++]= cacheValueMF;
}
// Add additional return values?
if(data.addAdditionalFields) {
for(int i=0; i<meta.getValue().length; i++) {
int nf=i+index;
int nr=i+1;
rowData[nf] = cachedData[nr];
}
}
}
}
return rowData;
}
示例8: get_RefinedSoundEx
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的package包/类
public static String get_RefinedSoundEx(ValueMetaInterface metaA, Object dataA)
{
if(dataA==null) return null;
return (new RefinedSoundex()).encode(dataA.toString());
}
示例9: get_RefinedSoundEx
import org.apache.commons.codec.language.RefinedSoundex; //导入依赖的package包/类
public static String get_RefinedSoundEx( ValueMetaInterface metaA, Object dataA ) {
if ( dataA == null ) {
return null;
}
return ( new RefinedSoundex() ).encode( dataA.toString() );
}