summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-09-09 14:41:36 +0800
committerPeng Wu <alexepico@gmail.com>2013-09-09 14:41:36 +0800
commitd1028a43ac2bbadb81a0a5fdc705010c9187f58f (patch)
tree9004be6ccca1c5ac858407380af3fbb49a3fe9c9
parent7277d46872aaf9d1fa45d2d7cfe00e27aa8cf201 (diff)
downloadlibzhuyin-d1028a43ac2bbadb81a0a5fdc705010c9187f58f.tar.gz
libzhuyin-d1028a43ac2bbadb81a0a5fdc705010c9187f58f.tar.xz
libzhuyin-d1028a43ac2bbadb81a0a5fdc705010c9187f58f.zip
begin to support auto correct
-rw-r--r--scripts/genpinyintable.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/genpinyintable.py b/scripts/genpinyintable.py
index 27b047f..68ee239 100644
--- a/scripts/genpinyintable.py
+++ b/scripts/genpinyintable.py
@@ -22,6 +22,7 @@
import operator
from bopomofo import BOPOMOFO_HANYU_PINYIN_MAP, BOPOMOFO_LUOMA_PINYIN_MAP, BOPOMOFO_SECONDARY_BOPOMOFO_MAP
from pinyintable import *
+from correct import *
from chewingkey import gen_table_index
@@ -138,6 +139,13 @@ def gen_secondary_bopomofo_index():
entries.append(entry)
return ',\n'.join(entries)
+def check_rule(correct, wrong):
+ if '*' not in correct:
+ assert '*' not in wrong
+ elif correct.endswith('*'):
+ assert wrong.endswith('*')
+ return True
+
def gen_chewing_key_table():
return gen_table_index(content_table)