From dd7854719999d0d431960c7c3ba73aec2dd764c7 Mon Sep 17 00:00:00 2001 From: nl <3210346136@qq.com> Date: Sun, 5 Dec 2021 23:06:11 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=94=B9=E5=86=92=E6=B3=A1=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=E4=B8=BAsorted=E5=BF=AB=E6=8E=92=E4=BB=A5=E6=8F=90?= =?UTF-8?q?=E5=8D=87=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LanguageModel2.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/LanguageModel2.py b/LanguageModel2.py index b36752a..7ff090b 100644 --- a/LanguageModel2.py +++ b/LanguageModel2.py @@ -166,12 +166,7 @@ class ModelLanguage(): # 语音模型类 list_words = list_words_2 #print(list_words,'\n') #print(list_words) - for i in range(0, len(list_words)): - for j in range(i + 1, len(list_words)): - if list_words[i][1] < list_words[j][1]: - tmp = list_words[i] - list_words[i] = list_words[j] - list_words[j] = tmp + list_words = sorted(list_words, key=lambda x:x[1], reverse=True) return list_words