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

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

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

Metaphone.isMetaphoneEqual介绍

[英]Tests is the metaphones of two strings are identical.
[中]测试是两个字符串的变音是相同的。

代码示例

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

public void assertIsMetaphoneEqual(final String source, final String[] matches) {
  // match source to all matches
  for (final String matche : matches) {
    assertTrue("Source: " + source + ", should have same Metaphone as: " + matche,
          this.getStringEncoder().isMetaphoneEqual(source, matche));
  }
  // match to each other
  for (final String matche : matches) {
    for (final String matche2 : matches) {
      assertTrue(this.getStringEncoder().isMetaphoneEqual(matche, matche2));
    }
  }
}

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

public void assertMetaphoneEqual(final String[][] pairs) {
  this.validateFixture(pairs);
  for (final String[] pair : pairs) {
    final String name0 = pair[0];
    final String name1 = pair[1];
    final String failMsg = "Expected match between " + name0 + " and " + name1;
    assertTrue(failMsg, this.getStringEncoder().isMetaphoneEqual(name0, name1));
    assertTrue(failMsg, this.getStringEncoder().isMetaphoneEqual(name1, name0));
  }
}

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

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

相关文章