summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2025-12-30 16:04:41 +0800
committerPeng Wu <alexepico@gmail.com>2025-12-30 16:04:41 +0800
commit4f707c0959c67f2d74a475c0b511c5bc9a17b0e7 (patch)
tree657c48abfc3ad448861f73e316172d50e59c0af4
parentbc56a511390c7aa4a6b7f2f8e115e3f865f8bbe1 (diff)
downloadlibpinyin-4f707c0959c67f2d74a475c0b511c5bc9a17b0e7.tar.gz
libpinyin-4f707c0959c67f2d74a475c0b511c5bc9a17b0e7.tar.xz
libpinyin-4f707c0959c67f2d74a475c0b511c5bc9a17b0e7.zip
Update script2
-rw-r--r--scripts2/fullpinyintable.py9
-rw-r--r--scripts2/options.py9
2 files changed, 16 insertions, 2 deletions
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