commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1075947 - in /commons/proper/codec/trunk/src: java/org/apache/commons/codec/language/Caverphone.java test/org/apache/commons/codec/language/CaverphoneTest.java
Date Tue, 01 Mar 2011 17:56:14 GMT
Author: ggregory
Date: Tue Mar  1 17:56:14 2011
New Revision: 1075947

URL: http://svn.apache.org/viewvc?rev=1075947&view=rev
Log:
[CODEC-117] Caverphone encodes names starting and ending with "mb" incorrectly.

Modified:
    commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone.java
    commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/CaverphoneTest.java

Modified: commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone.java?rev=1075947&r1=1075946&r2=1075947&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone.java
(original)
+++ commons/proper/codec/trunk/src/java/org/apache/commons/codec/language/Caverphone.java
Tue Mar  1 17:56:14 2011
@@ -71,7 +71,9 @@ public class Caverphone implements Strin
         txt = txt.replaceAll("^enough", "enou2f");  // 2.0 only
         txt = txt.replaceAll("^trough", "trou2f");  // 2.0 only - note the spec says ^enough
here again, c+p error I assume
         txt = txt.replaceAll("^gn", "2n");
-        txt = txt.replaceAll("^mb", "m2");
+
+        // End 
+        txt = txt.replaceAll("mb$", "m2");
 
         // 4. Handle replacements
         txt = txt.replaceAll("cq", "2q");

Modified: commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/CaverphoneTest.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/CaverphoneTest.java?rev=1075947&r1=1075946&r2=1075947&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/CaverphoneTest.java
(original)
+++ commons/proper/codec/trunk/src/test/org/apache/commons/codec/language/CaverphoneTest.java
Tue Mar  1 17:56:14 2011
@@ -169,83 +169,6 @@ public class CaverphoneTest extends Stri
      * 
      * @throws EncoderException
      */
-    public void testDavidHoodRevisitedRandomNameTTA1111111() throws EncoderException {
-        this.checkEncodingVariations("TTA1111111", new String[]{
-            "Darda",
-            "Datha",
-            "Dedie",
-            "Deedee",
-            "Deerdre",
-            "Deidre",
-            "Deirdre",
-            "Detta",
-            "Didi",
-            "Didier",
-            "Dido",
-            "Dierdre",
-            "Dieter",
-            "Dita",
-            "Ditter",
-            "Dodi",
-            "Dodie",
-            "Dody",
-            "Doherty",
-            "Dorthea",
-            "Dorthy",
-            "Doti",
-            "Dotti",
-            "Dottie",
-            "Dotty",
-            "Doty",
-            "Doughty",
-            "Douty",
-            "Dowdell",
-            "Duthie",
-            "Tada",
-            "Taddeo",
-            "Tadeo",
-            "Tadio",
-            "Tati",
-            "Teador",
-            "Tedda",
-            "Tedder",
-            "Teddi",
-            "Teddie",
-            "Teddy",
-            "Tedi",
-            "Tedie",
-            "Teeter",
-            "Teodoor",
-            "Teodor",
-            "Terti",
-            "Theda",
-            "Theodor",
-            "Theodore",
-            "Theta",
-            "Thilda",
-            "Thordia",
-            "Tilda",
-            "Tildi",
-            "Tildie",
-            "Tildy",
-            "Tita",
-            "Tito",
-            "Tjader",
-            "Toddie",
-            "Toddy",
-            "Torto",
-            "Tuddor",
-            "Tudor",
-            "Turtle",
-            "Tuttle",
-            "Tutto"});
-    }
-
-    /**
-     * See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
-     * 
-     * @throws EncoderException
-     */
     public void testDavidHoodRevisitedRandomNameTN11111111() throws EncoderException {
         this.checkEncodingVariations("TN11111111", new String[]{
             "Dan",
@@ -324,12 +247,94 @@ public class CaverphoneTest extends Stri
      * 
      * @throws EncoderException
      */
+    public void testDavidHoodRevisitedRandomNameTTA1111111() throws EncoderException {
+        this.checkEncodingVariations("TTA1111111", new String[]{
+            "Darda",
+            "Datha",
+            "Dedie",
+            "Deedee",
+            "Deerdre",
+            "Deidre",
+            "Deirdre",
+            "Detta",
+            "Didi",
+            "Didier",
+            "Dido",
+            "Dierdre",
+            "Dieter",
+            "Dita",
+            "Ditter",
+            "Dodi",
+            "Dodie",
+            "Dody",
+            "Doherty",
+            "Dorthea",
+            "Dorthy",
+            "Doti",
+            "Dotti",
+            "Dottie",
+            "Dotty",
+            "Doty",
+            "Doughty",
+            "Douty",
+            "Dowdell",
+            "Duthie",
+            "Tada",
+            "Taddeo",
+            "Tadeo",
+            "Tadio",
+            "Tati",
+            "Teador",
+            "Tedda",
+            "Tedder",
+            "Teddi",
+            "Teddie",
+            "Teddy",
+            "Tedi",
+            "Tedie",
+            "Teeter",
+            "Teodoor",
+            "Teodor",
+            "Terti",
+            "Theda",
+            "Theodor",
+            "Theodore",
+            "Theta",
+            "Thilda",
+            "Thordia",
+            "Tilda",
+            "Tildi",
+            "Tildie",
+            "Tildy",
+            "Tita",
+            "Tito",
+            "Tjader",
+            "Toddie",
+            "Toddy",
+            "Torto",
+            "Tuddor",
+            "Tudor",
+            "Turtle",
+            "Tuttle",
+            "Tutto"});
+    }
+
+    /**
+     * See http://caversham.otago.ac.nz/files/working/ctp150804.pdf
+     * 
+     * @throws EncoderException
+     */
     public void testDavidHoodRevisitedRandomWords() throws EncoderException {
         this.checkEncodingVariations("RTA1111111", new String[]{"rather", "ready", "writer"});
         this.checkEncoding("SSA1111111", "social");
         this.checkEncodingVariations("APA1111111", new String[]{"able", "appear"});
     }
 
+    public void testEndMb() throws EncoderException {
+        String[][] data = {{"mb", "M111111111"}, {"mbmb", "MPM1111111"}};
+        this.checkEncodings(data);
+    }
+
     // Caverphone Revisited
     public void testIsCaverphoneEquals() {
         Caverphone caverphone = new Caverphone();



Mime
View raw message