From 206b35fff384dbed1d4ebb910becd87b982b90cf Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Mon, 6 Oct 2025 20:55:46 +0800 Subject: [PATCH] =?UTF-8?q?chore(repo):=20=E4=BC=98=E5=8C=96=E4=BB=93?= =?UTF-8?q?=E5=BA=93=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {src/chat/utils => depends-data}/dict.txt | 0 src/chat/utils/typo_generator.py | 4 +++- 2 files changed, 3 insertions(+), 1 deletion(-) rename {src/chat/utils => depends-data}/dict.txt (100%) diff --git a/src/chat/utils/dict.txt b/depends-data/dict.txt similarity index 100% rename from src/chat/utils/dict.txt rename to depends-data/dict.txt diff --git a/src/chat/utils/typo_generator.py b/src/chat/utils/typo_generator.py index 7870b7335..b88538a69 100644 --- a/src/chat/utils/typo_generator.py +++ b/src/chat/utils/typo_generator.py @@ -56,7 +56,9 @@ class ChineseTypoGenerator: # 使用内置的词频文件 char_freq = defaultdict(int) - dict_path = os.path.join(os.path.dirname(__file__), "dict.txt") + # 从当前文件向上返回三级目录到项目根目录,然后拼接路径 + base_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) + dict_path = os.path.join(base_dir, "depends-data", "dict.txt") # 读取rjieba的词典文件 with open(dict_path, encoding="utf-8") as f: