summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/gentable.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/gentable.py b/scripts/gentable.py
index 0e98379..1a325be 100644
--- a/scripts/gentable.py
+++ b/scripts/gentable.py
@@ -62,9 +62,27 @@ def gen_context_table():
return ',\n'.join(entries)
+def gen_pinyin_index():
+ entries = []
+ for (wrong, flags, correct) in pinyin_index:
+ index = [x[0] for x in content_table].index(correct)
+ entry = '{{"{0}", {1}, {2}}}'.format(wrong, flags, index)
+ entries.append(entry)
+ return ',\n'.join(entries)
+
+
+def gen_bopomofo_index():
+ entries = []
+ for (bopomofo_str, flags, bopomofo) in bopomofo_index:
+ index = [x[0] for x in content_table].index(bopomofo)
+ entry = '{{"{0}", {1}, {2}}}'.format(bopomofo_str, flags, index)
+ entries.append(entry)
+ return ',\n'.join(entries)
+
+
### main function ###
if __name__ == "__main__":
filter_pinyin_list()
sort_all()
- table = gen_context_table()
- print(table)
+ s = gen_pinyin_index()
+ print(s)