Skip to content

Commit 0d3c0d9

Browse files
evilstarwangdan-fit2cloud
authored andcommitted
修复:关键词提取的bug (#621)
1 parent 00cb9eb commit 0d3c0d9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/common/util/ts_vecto_util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ def replace_word(word_dict, text: str):
5454

5555

5656
def get_word_key(text: str, use_word_list):
57-
for j_word in jieba_word_list_cache:
58-
if not text.__contains__(j_word) and not use_word_list.__contains__(j_word):
59-
return j_word
57+
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)),
58+
None)
59+
if j_word:
60+
return j_word
6061
j_word = str(uuid.uuid1())
6162
jieba.add_word(j_word)
6263
return j_word

0 commit comments

Comments
 (0)