From 2882bd675e85c5a34391cd419e94631e24c2a659 Mon Sep 17 00:00:00 2001 From: XU LU Date: Sat, 22 Jul 2023 12:00:52 +0800 Subject: [PATCH] Fix the issue of parse_readline --- 06/inout.py | 2 +- 06/out_readline.txt | 129 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 114 insertions(+), 17 deletions(-) diff --git a/06/inout.py b/06/inout.py index 4e029bba..a483a8e3 100644 --- a/06/inout.py +++ b/06/inout.py @@ -54,7 +54,7 @@ def parse_readline(infile): # 按照词频排序 sorted_word_cnt = sorted(word_cnt.items(), key = lambda kv: kv[1], reverse = True) - return sorted_word_cnt + return sorted_word_cnt if __name__ == "__main__": diff --git a/06/out_readline.txt b/06/out_readline.txt index fb377762..65925f14 100644 --- a/06/out_readline.txt +++ b/06/out_readline.txt @@ -1,30 +1,127 @@ -a 3 -i 2 -have 2 -dream 2 -will 2 +and 15 +be 13 +will 11 +to 11 +the 10 +of 10 +a 8 +we 8 +day 6 +able 6 +every 6 +together 6 +i 5 +have 5 +dream 5 +that 5 +one 5 +with 5 +this 5 +in 4 +shall 4 +free 4 +when 4 +little 3 +black 3 +white 3 +made 3 +faith 3 +at 3 +last 3 +children 2 +nation 2 by 2 -the 2 -of 2 their 2 -that 1 +today 2 +alabama 2 +boys 2 +girls 2 +join 2 +hands 2 +mountain 2 +places 2 +all 2 +it 2 +our 2 +hope 2 +up 2 +freedom 2 +ring 2 +from 2 +god 2 +men 2 my 1 four 1 -little 1 -children 1 -one 1 -day 1 live 1 -in 1 -nation 1 where 1 they 1 not 1 -be 1 judged 1 color 1 skin 1 but 1 content 1 character 1 -today 1 +down 1 +its 1 +vicious 1 +racists 1 +right 1 +there 1 +as 1 +sisters 1 +brothers 1 +valley 1 +exalted 1 +hill 1 +low 1 +rough 1 +plain 1 +crooked 1 +straight 1 +glory 1 +lord 1 +revealed 1 +flesh 1 +see 1 +is 1 +hew 1 +out 1 +despair 1 +stone 1 +transform 1 +jangling 1 +discords 1 +into 1 +beautiful 1 +symphony 1 +brotherhood 1 +work 1 +pray 1 +struggle 1 +go 1 +jail 1 +stand 1 +for 1 +knowing 1 +happens 1 +allow 1 +let 1 +village 1 +hamlet 1 +state 1 +city 1 +speed 1 +s 1 +jews 1 +gentiles 1 +protestants 1 +catholics 1 +sing 1 +words 1 +old 1 +negro 1 +spiritual 1 +thank 1 +almighty 1 +are 1