org.apache.commons.codec.language.Metaphone.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.apache.commons.codec.language.Metaphone.<init>()方法的一些代码示例,展示了Metaphone.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metaphone.<init>()方法的具体详情如下:
包路径:org.apache.commons.codec.language.Metaphone
类名称:Metaphone
方法名:<init>

Metaphone.<init>介绍

[英]Creates an instance of the Metaphone encoder
[中]创建变音编码器的实例

代码示例

代码示例来源:origin: commons-codec/commons-codec

@Override
protected Metaphone createStringEncoder() {
  return new Metaphone();
}

代码示例来源:origin: pentaho/pentaho-kettle

public static String get_Metaphone( ValueMetaInterface metaA, Object dataA ) {
 if ( dataA == null ) {
  return null;
 }
 return ( new Metaphone() ).metaphone( dataA.toString() );
}

代码示例来源:origin: apache/drill

@Override
public void eval() {
 String input = org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(rawInput.start, rawInput.end, rawInput.buffer);
 String outputString = new org.apache.commons.codec.language.Metaphone().metaphone(input);
 out.buffer = buffer;
 out.start = 0;
 out.end = outputString.getBytes().length;
 buffer.setBytes(0, outputString.getBytes());
}

代码示例来源:origin: pentaho/pentaho-kettle

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;
}

代码示例来源:origin: dkpro/dkpro-core

public MetaphonePhoneticTranscriptor()
  {
    this.encoder = new Metaphone();
  }
}

代码示例来源:origin: stackoverflow.com

public MetaphoneDistance() {
  Metaphone metaphone = new Metaphone();
}

//I'm not really familiar with the library you mentioned, but I assume generateKeys performs a double metaphone?
public float getDistance(String str1, ,String str2) {
  String[] keys1 = metaphone.getKeys(str1);  
  String[] keys2 = metaphone.getKeys(str2);
  float result = 0;
  if (key1[0] == key2[0] || key1[0] == key2[1]) result += .5
  if (key1[1] == key2[0] || key1[1] == key2[1]) result += .5
  return result;
}

代码示例来源:origin: dkpro/dkpro-similarity

public MetaphoneComparator()
{
  encoder = new Metaphone();
}

代码示例来源:origin: Simmetrics/simmetrics

/**
 * Creates an instance of the Metaphone simplifier with a
 * {@code maxCodeLength}. All encodings will have at most
 * {@code maxCodeLength} characters.
 * 
 * @param maxCodeLength
 *            maximum length of the encoding
 */
public Metaphone(int maxCodeLength) {
  this.simplifier = new org.apache.commons.codec.language.Metaphone();
  this.simplifier.setMaxCodeLen(maxCodeLength);
}

代码示例来源:origin: stackoverflow.com

Metaphone meta = new Metaphone();
meta.setMaxCodeLen(8);
System.out.println(meta.isMetaphoneEqual("cricket","criket"));
System.out.println(meta.isMetaphoneEqual("cricket","criketgame"));

相关文章