From 3a7c4d35688dc03b09c128e7c274313b4ce489ee Mon Sep 17 00:00:00 2001 From: evilstar Date: Tue, 11 Jun 2024 18:25:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=E5=85=B3=E9=94=AE=E8=AF=8D?= =?UTF-8?q?=E6=8F=90=E5=8F=96=E7=9A=84bug=20(#621)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/util/ts_vecto_util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/common/util/ts_vecto_util.py b/apps/common/util/ts_vecto_util.py index 451d87bf8..79d91bf1d 100644 --- a/apps/common/util/ts_vecto_util.py +++ b/apps/common/util/ts_vecto_util.py @@ -54,9 +54,10 @@ def replace_word(word_dict, text: str): def get_word_key(text: str, use_word_list): - for j_word in jieba_word_list_cache: - if not text.__contains__(j_word) and not use_word_list.__contains__(j_word): - return j_word + j_word = next((j for j in jieba_word_list_cache if j not in text and all(j not in used for used in use_word_list)), + None) + if j_word: + return j_word j_word = str(uuid.uuid1()) jieba.add_word(j_word) return j_word