本文整理了Java中org.apache.commons.codec.language.Metaphone.isMetaphoneEqual()
方法的一些代码示例,展示了Metaphone.isMetaphoneEqual()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metaphone.isMetaphoneEqual()
方法的具体详情如下:
包路径:org.apache.commons.codec.language.Metaphone
类名称: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"));
内容来源于网络,如有侵权,请联系作者删除!