Skip to content

Commit

Permalink
修复:关键词提取的bug (1Panel-dev#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilstar2016 authored Jun 11, 2024
1 parent cdc7e13 commit 3a7c4d3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions apps/common/util/ts_vecto_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3a7c4d3

Please sign in to comment.