diff options
author | Peng Wu <alexepico@gmail.com> | 2011-11-09 09:25:18 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-11-09 09:25:18 +0800 |
commit | 083a9fb6a32b1750c0924baf8cee550d75da64c3 (patch) | |
tree | 78798fc83d3af14e6ab8824b411066fb4b8b70ad /scripts | |
parent | 2980b45009e45b12fe233d945fea1be3275de26d (diff) | |
download | libpinyin-083a9fb6a32b1750c0924baf8cee550d75da64c3.tar.gz libpinyin-083a9fb6a32b1750c0924baf8cee550d75da64c3.tar.xz libpinyin-083a9fb6a32b1750c0924baf8cee550d75da64c3.zip |
refine python code
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/genpinyintable.py | 7 | ||||
-rw-r--r-- | scripts/genspecialtable.py | 13 | ||||
-rw-r--r-- | scripts/specialtable.py | 4 |
3 files changed, 14 insertions, 10 deletions
diff --git a/scripts/genpinyintable.py b/scripts/genpinyintable.py index 9a1a273..eafbf5e 100644 --- a/scripts/genpinyintable.py +++ b/scripts/genpinyintable.py @@ -80,9 +80,12 @@ def gen_bopomofo_index(): return ',\n'.join(entries) +#init code +filter_pinyin_list() +sort_all() + + ### main function ### if __name__ == "__main__": - filter_pinyin_list() - sort_all() s = gen_content_table() + gen_pinyin_index() + gen_bopomofo_index() print(s) diff --git a/scripts/genspecialtable.py b/scripts/genspecialtable.py index 9abe0e4..0ef9d44 100644 --- a/scripts/genspecialtable.py +++ b/scripts/genspecialtable.py @@ -83,15 +83,14 @@ def gen_resplit_table(): return ',\n'.join(entries) -### main function ### -if __name__ == "__main__": - load_phrase("pinyin2.txt") +#init code, load lists +divided_list = filter_divided() +resplit_list = filter_resplit() +sort_all() - #load lists - divided_list = filter_divided() - resplit_list = filter_resplit() - sort_all() +### main function ### +if __name__ == "__main__": s = gen_divided_table() + '\n' + gen_resplit_table() print(s) diff --git a/scripts/specialtable.py b/scripts/specialtable.py index 6976bb7..acb66cf 100644 --- a/scripts/specialtable.py +++ b/scripts/specialtable.py @@ -103,8 +103,10 @@ def filter_resplit(): new_first_key, new_second_key, new_freq +#init code +load_phrase("pinyin2.txt") + if __name__ == "__main__": - load_phrase("pinyin2.txt") for p in filter_divided(): print (p) for p in filter_resplit(): |