summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-09-17 11:29:38 +0800
committerPeng Wu <alexepico@gmail.com>2013-09-17 11:29:38 +0800
commit78f7c4db3351ae1b71677e6c70a96da3bec5a191 (patch)
treeaee1f04b99b2595d69c5ca6da40feb0e977e725d /scripts
parent4aea76388dd426abf5d4d190e8c73caa2bce0182 (diff)
downloadlibzhuyin-78f7c4db3351ae1b71677e6c70a96da3bec5a191.tar.gz
libzhuyin-78f7c4db3351ae1b71677e6c70a96da3bec5a191.tar.xz
libzhuyin-78f7c4db3351ae1b71677e6c70a96da3bec5a191.zip
fixes populate_more_bopomofo_index
Diffstat (limited to 'scripts')
-rw-r--r--scripts/genpinyintable.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/scripts/genpinyintable.py b/scripts/genpinyintable.py
index 029725f..1594a91 100644
--- a/scripts/genpinyintable.py
+++ b/scripts/genpinyintable.py
@@ -67,7 +67,6 @@ def populate_more_bopomofo_index():
for (bopomofo, flags) in bopomofo_index:
# populate hsu bopomofo index
correct = bopomofo
- hsu_bopomofo_index.append((bopomofo, flags, correct))
matches = itertools.chain(handle_rules(bopomofo, hsu_correct),
handle_special_rules(bopomofo, hsu_correct_special))
for wrong in matches:
@@ -75,13 +74,20 @@ def populate_more_bopomofo_index():
hsu_bopomofo_index.append((wrong, newflags, correct))
# populate eten26 bopomofo index
- eten26_bopomofo_index.append((bopomofo, flags, correct))
matches = itertools.chain(handle_rules(bopomofo, eten26_correct),
handle_special_rules(bopomofo, eten26_correct_special))
for wrong in matches:
newflags = '|'.join((flags, 'ETEN26_CORRECT'))
eten26_bopomofo_index.append((wrong, newflags, correct))
+ for (bopomofo, flags) in bopomofo_index:
+ correct = bopomofo
+ # remove duplicate items
+ if bopomofo not in [x[0] for x in hsu_bopomofo_index]:
+ hsu_bopomofo_index.append((bopomofo, flags, correct))
+
+ if bopomofo not in [x[0] for x in eten26_bopomofo_index]:
+ eten26_bopomofo_index.append((bopomofo, flags, correct))
def sort_all():
global content_table, hanyu_pinyin_index, luoma_pinyin_index