From d1028a43ac2bbadb81a0a5fdc705010c9187f58f Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Mon, 9 Sep 2013 14:41:36 +0800 Subject: begin to support auto correct --- scripts/genpinyintable.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts/genpinyintable.py') 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) -- cgit