From e1c5afc9cbcda838c3734385faebfeb07f322034 Mon Sep 17 00:00:00 2001 From: zhiyang7 Date: Thu, 24 Feb 2022 11:26:05 +0800 Subject: [PATCH] minor fix --- main.py | 14 +++++++++----- templates/index.html | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/main.py b/main.py index c7386fe..14f91f7 100644 --- a/main.py +++ b/main.py @@ -101,8 +101,12 @@ def init(): global all_idiom if os.path.exists("all_idiom.csv"): all_idiom = pd.read_csv('all_idiom.csv') - all_idiom["pinyin_initials"].str.split(",").explode("splited").value_counts().to_json() - all_idiom["pinyin_finals"].str.split(",").explode("splited").value_counts().to_json() + # all_idiom["pinyin_initials"].str.split(",").explode("splited").value_counts().to_json() + # all_idiom["pinyin_finals"].str.split(",").explode("splited").value_counts().to_json() + # four_idiom = all_idiom[all_idiom['word'].str.len() == 4] + # four_idiom["tone_len"] = four_idiom.apply(lambda x: len(set(x['pinyin_tone'])), axis=1) + # four_idiom = four_idiom[four_idiom['tone_len'] == 4] + # four_idiom["pinyin_tone"].value_counts().to_json() else: all_idiom = pd.read_json('idiom.json') idiom_frequency = pd.read_csv('idiom_frequency.csv') @@ -313,7 +317,7 @@ def main(argv): # mode = '1' # parameter = 'bai vvv vv vvv,012 000 00 000;bai tou er xin,012 010 10 001' mode = '2' - parameter = '2134' + parameter = '1243' # mode = '3' # parameter = '行之有效,00 11 10 00 0100 1101;各执一词,00 11 12 22 0010 1022' num = 6 @@ -342,5 +346,5 @@ if __name__ == '__main__': current_work_dir = os.path.dirname(__file__) os.chdir(current_work_dir) init() - # main(sys.argv[1:]) - app.run(debug=True, host="0.0.0.0") + main(sys.argv[1:]) + # app.run(debug=True, host="0.0.0.0") diff --git a/templates/index.html b/templates/index.html index 431bce8..571247d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -92,7 +92,7 @@ $("#parameter").attr('placeholder', 'bai tou er xin,012 010 10 001') break case '2': - $("#parameter").attr('placeholder', '2134') + $("#parameter").attr('placeholder', '1243') break case '3': $("#parameter").attr('placeholder', '各执一词,00 11 12 22 0010 1022')