fix(chat): 修复typo_generator中词典文件的路径问题
词典文件的路径从依赖`rjieba`包的位置改为相对于当前文件的相对路径,以确保在不同环境下都能正确找到文件。
This commit is contained in:
349045
src/chat/utils/dict.txt
Normal file
349045
src/chat/utils/dict.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -56,7 +56,7 @@ class ChineseTypoGenerator:
|
||||
|
||||
# 使用内置的词频文件
|
||||
char_freq = defaultdict(int)
|
||||
dict_path = os.path.join(os.path.dirname(rjieba.__file__), "dict.txt")
|
||||
dict_path = os.path.join(os.path.dirname(__file__), "dict.txt")
|
||||
|
||||
# 读取rjieba的词典文件
|
||||
with open(dict_path, encoding="utf-8") as f:
|
||||
|
||||
Reference in New Issue
Block a user