修复:关键词提取的bug (#621)

This commit is contained in:
evilstar 2024-06-11 18:25:12 +08:00 committed by GitHub
parent cdc7e13415
commit 3a7c4d3568
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,8 +54,9 @@ def replace_word(word_dict, text: str):
def get_word_key(text: str, use_word_list): def get_word_key(text: str, use_word_list):
for j_word in jieba_word_list_cache: 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)),
if not text.__contains__(j_word) and not use_word_list.__contains__(j_word): None)
if j_word:
return j_word return j_word
j_word = str(uuid.uuid1()) j_word = str(uuid.uuid1())
jieba.add_word(j_word) jieba.add_word(j_word)