fix:知识库上传文档操作报异常,错误发生在 ts_vecto_util.py 文件的 replace_word 函数中:错误的原因是正则表达式模式在某个位置缺少一个右括号,使得子模式未完全结束。该提交修复了这个问题。 (#667)
This commit is contained in:
parent
1af7fcb63c
commit
726ba2a8e2
@ -49,7 +49,8 @@ def get_word_list(text: str):
|
|||||||
|
|
||||||
def replace_word(word_dict, text: str):
|
def replace_word(word_dict, text: str):
|
||||||
for key in word_dict:
|
for key in word_dict:
|
||||||
text = re.sub('(?<!#)' + word_dict[key] + '(?!#)', key, text)
|
pattern = '(?<!#)' + re.escape(word_dict[key]) + '(?!#)'
|
||||||
|
text = re.sub(pattern, key, text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user