add Ge<=>Ke fuzzy pinyin
authorPeng Wu <alexepico@gmail.com>
Mon, 8 Aug 2011 05:44:49 +0000 (13:44 +0800)
committerPeng Wu <alexepico@gmail.com>
Mon, 8 Aug 2011 05:44:49 +0000 (13:44 +0800)
src/storage/pinyin_base.cpp
src/storage/pinyin_base.h
src/storage/pinyin_large_table.cpp

index c12c7ba08a167780cec8171c14b373125ba32d4c..e7715a079778ce91cdc1415a8f707021d99bdfe8 100644 (file)
@@ -60,8 +60,8 @@ static const PinyinToken __pinyin_initials[] =
     {"f", "ㄈ", 1, 1},
     {"h", "ㄏ", 1, 1},
     {"g", "ㄍ", 1, 1},
-    {"j", "ㄐ", 1, 1},
     {"k", "ㄎ", 1, 1},
+    {"j", "ㄐ", 1, 1},
     {"m", "ㄇ", 1, 1},
     {"n", "ㄋ", 1, 1},
     {"l", "ㄌ", 1, 1},
@@ -135,7 +135,7 @@ static const PinyinToken __pinyin_tones [] =
 static const PinyinTokenIndex __pinyin_initials_index[] =
 {
     //a     b      c      d     e       f      g      h      i      j      k      l      m 
-    {-1,0},{1,1}, {2,2}, {4,1}, {-1,0},{5,1}, {7,1}, {6,1}, {-1,0},{8,1}, {9,1}, {12,1},{10,1},
+    {-1,0},{1,1}, {2,2}, {4,1}, {-1,0},{5,1}, {7,1}, {6,1}, {-1,0},{9,1}, {8,1}, {12,1},{10,1},
     //n     o      p      q      r      s      t      u      v      w      x      y      z
     {11,1},{-1,0},{14,1},{15,1},{13,1},{16,2},{18,1},{-1,0},{-1,0},{19,1},{20,1},{21,1},{22,2}
 };
@@ -1381,7 +1381,11 @@ int pinyin_compare_initial (const PinyinCustomSettings &custom,
 
                (custom.use_ambiguities [PINYIN_AmbFoHe] && 
                 ((lhs == PINYIN_Fo && rhs == PINYIN_He) ||
-                 (lhs == PINYIN_He && rhs == PINYIN_Fo)))
+                 (lhs == PINYIN_He && rhs == PINYIN_Fo))) ||
+
+               (custom.use_ambiguities [PINYIN_AmbGeKe] &&
+                ((lhs == PINYIN_Ge && rhs == PINYIN_Ke) ||
+                 (lhs == PINYIN_Ke && rhs == PINYIN_Ge)))
            )
          return 0;
        else return (lhs - rhs);
index 4c154541b5734372e7a6678cd56f1ff9c2b5da53..14d3a994a45d32a49782f346e9e50ae530e50b4a 100644 (file)
@@ -84,8 +84,8 @@ enum PinyinInitial
     PINYIN_Fo  = 5,
     PINYIN_He  = 6,
     PINYIN_Ge  = 7,
-    PINYIN_Ji  = 8,
-    PINYIN_Ke  = 9,
+    PINYIN_Ke  = 8,
+    PINYIN_Ji  = 9,
     PINYIN_Mo  =10,
     PINYIN_Ne  =11,
     PINYIN_Le  =12,
@@ -213,6 +213,7 @@ enum PinyinAmbiguity
     PINYIN_AmbNeLe,
     PINYIN_AmbLeRi,
     PINYIN_AmbFoHe,
+    PINYIN_AmbGeKe,
     PINYIN_AmbAnAng,
     PINYIN_AmbEnEng,
     PINYIN_AmbInIng,
index c098ece9e6800212dbc88df24e18a9319f089103..d9094a5f8a2b9a3f2cbbec66f3a9173c52faa32b 100644 (file)
@@ -130,6 +130,8 @@ int PinyinBitmapIndexLevel::initial_level_search(int phrase_length,
        MATCH(PINYIN_AmbNeLe, PINYIN_Ne, PINYIN_Le);
        MATCH(PINYIN_AmbFoHe, PINYIN_Fo, PINYIN_He);
        MATCH(PINYIN_AmbFoHe, PINYIN_He, PINYIN_Fo);
+        MATCH(PINYIN_AmbGeKe, PINYIN_Ge, PINYIN_Ke);
+        MATCH(PINYIN_AmbGeKe, PINYIN_Ke, PINYIN_Ge);
 
     case PINYIN_Le:
        {