commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1073513 - in /commons/proper/codec/trunk/src: java/org/apache/commons/codec/language/ColognePhonetic.java test/org/apache/commons/codec/language/ColognePhoneticTest.java
Date Tue, 22 Feb 2011 21:19:19 GMT
Author: ggregory
Date: Tue Feb 22 21:19:19 2011
New Revision: 1073513

URL: http://svn.apache.org/viewvc?rev=1073513&view=rev
Log:
Eberhard -> 01772 (not 0172) because two or more identical consecutive digits can occur
if they occur after removing the "0" digits last step.

Modified:
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java?rev=1073513&r1=1073512&r2=1073513&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
(original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/ColognePhonetic.java
Tue Feb 22 21:19:19 2011
@@ -165,7 +165,8 @@ import org.apache.commons.codec.StringEn
  * 
  * <li>
  * <h3>Third step:</h3>
- * Removal of all codes “0” except at the beginning
+ * Removal of all codes “0” except at the beginning. This means that two or more
identical consecutive digits can occur
+ *  if they occur after removing the "0" digits.
  * 
  * <h4>Example:</h4>
  * {@code "6050750206802" => "65752682"}</li>
@@ -368,10 +369,10 @@ public class ColognePhonetic implements 
 
             if (code != '-' && (lastCode != code && (code != '0' || lastCode
== '/') || code < '0' || code > '8')) {
                 left.addRight(code);
-                lastCode = code;
             }
 
             lastChar = chr;
+            lastCode = code;
         }
         return left.toString();
     }

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java?rev=1073513&r1=1073512&r2=1073513&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
(original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/ColognePhoneticTest.java
Tue Feb 22 21:19:19 2011
@@ -100,13 +100,13 @@ public class ColognePhoneticTest extends
             {"weber", "317"},
             // {"wagner", "357"},
             {"becker", "147"},
-            {"hoffmann", "036"},
+            {"hoffmann", "0366"},
             {"sch\u00C4fer", "837"},
             {"Breschnew", "17863"},
             {"Wikipedia", "3412"},
             {"peter", "127"},
             {"pharma", "376"},
-            {"mönchengladbach", "64645214"},
+            {"mönchengladbach", "664645214"},
             {"deutsch", "28"},
             {"deutz", "28"},
             {"hamburg", "06174"},
@@ -118,8 +118,8 @@ public class ColognePhoneticTest extends
             {"matsch", "68"},
             {"matz", "68"},
             {"Arbeitsamt", "071862"},
-            {"Eberhard", "0172"},
-            {"Eberhardt", "0172"},
+            {"Eberhard", "01772"},
+            {"Eberhardt", "01772"},
             {"heithabu", "021"}};
         this.checkEncodings(data);
     }
@@ -147,8 +147,14 @@ public class ColognePhoneticTest extends
         }
     }
 
-    public void testVariations() {
+    public void testVariationsMeyer() {
         String data[] = {"Meier", "Maier", "Mair", "Meyer", "Meyr", "Mejer", "Major"};
         this.checkEncodingVariations("67", data);
+
+    }
+
+    public void testVariationsMella() {
+        String data[] = {"mella", "milah", "moulla", "mellah", "muehle", "mule"};
+        this.checkEncodingVariations("65", data);
     }
 }



Mime
View raw message