You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2008/04/27 02:33:10 UTC

svn commit: r651873 - in /commons/proper/codec/trunk/src: java/org/apache/commons/codec/language/Metaphone.java test/org/apache/commons/codec/language/MetaphoneTest.java

Author: bayard
Date: Sat Apr 26 17:33:06 2008
New Revision: 651873

URL: http://svn.apache.org/viewvc?rev=651873&view=rev
Log:
Modifying the unit test for CODEC-57 to test for empty string, and added a note to the Metaphone javadoc that it does not match the PHP or Perl variants

Modified:
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Metaphone.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Metaphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Metaphone.java?rev=651873&r1=651872&r2=651873&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Metaphone.java (original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Metaphone.java Sat Apr 26 17:33:06 2008
@@ -30,6 +30,11 @@
  * <CITE>Hanging on the Metaphone</CITE> by <CITE>Lawrence Philips</CITE> in <CITE>Computer Language of Dec. 1990, p
  * 39.</CITE>
  * </p>
+ * <p>
+ * Note, that this does not match the algorithm that ships with PHP, or the algorithm 
+ * found in the Perl <a href="http://search.cpan.org/~mschwern/Text-Metaphone-1.96/Metaphone.pm">Text:Metaphone-1.96</a>.
+ * They have had undocumented changes from the originally published algorithm. 
+ * </p>
  * 
  * @author Apache Software Foundation
  * @version $Id$

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java?rev=651873&r1=651872&r2=651873&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java (original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/MetaphoneTest.java Sat Apr 26 17:33:06 2008
@@ -406,7 +406,8 @@
      * Tests (CODEC-57) Metaphone.metaphone(String) returns an empty string when passed the word "why"
      */
     public void testWhy() {
-        assertEquals("H", this.getMetaphone().metaphone("WHY"));
+        // PHP returns "H". The original metaphone returns an empty string. 
+        assertEquals("", this.getMetaphone().metaphone("WHY"));
     }
 
     public void testWordsWithCIA() {