From 4f707c0959c67f2d74a475c0b511c5bc9a17b0e7 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Tue, 30 Dec 2025 16:04:41 +0800 Subject: Update script2 --- scripts2/fullpinyintable.py | 9 +++++++++ scripts2/options.py | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'scripts2') diff --git a/scripts2/fullpinyintable.py b/scripts2/fullpinyintable.py index 4af94a9..6e5fdcb 100644 --- a/scripts2/fullpinyintable.py +++ b/scripts2/fullpinyintable.py @@ -94,6 +94,7 @@ def gen_pinyin_list(): gen_shengmu(), gen_corrects(), gen_u_to_v(), + gen_fuzzy_corrects(), ): yield p @@ -163,6 +164,14 @@ def gen_u_to_v(): zhuyin = PINYIN_ZHUYIN_MAP[pinyin] yield correct, wrong, zhuyin, flags, get_chewing(pinyin), distance +def gen_fuzzy_corrects(): + #generate fuzzy corrects + for correct, wrong, flag, distance in fuzzy_corrects: + #over-ride flags + flags = ['IS_PINYIN', flag] + pinyin = correct + zhuyin = PINYIN_ZHUYIN_MAP[pinyin] + yield correct, wrong, zhuyin, flags, get_chewing(pinyin), distance #pinyin table content_table = [] diff --git a/scripts2/options.py b/scripts2/options.py index e4bd01f..2fce4bb 100644 --- a/scripts2/options.py +++ b/scripts2/options.py @@ -21,7 +21,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. auto_correct = [ - # "correct", "wrong" + # "correct", "wrong", distance ("ng", "gn", 1), ("ng", "mg", 1), ("iu", "iou", 1), @@ -33,7 +33,7 @@ auto_correct = [ ] auto_correct_ext = [ - # "correct", "wrong", flag + # "correct", "wrong", flag, distance ("ju", "jv", "PINYIN_CORRECT_V_U", 1), ("qu", "qv", "PINYIN_CORRECT_V_U", 1), ("xu", "xv", "PINYIN_CORRECT_V_U", 1), @@ -92,6 +92,11 @@ fuzzy_yunmu = [ ("ing", "in"), ] +fuzzy_corrects = [ + # "correct", "wrong", flag, distance + ("shua", "sua", "PINYIN_AMB_S_SH", 1), + ("zhua", "zua", "PINYIN_AMB_Z_ZH", 1), +] # for HSU and ETEN26 -- cgit