From f2d9473ffe2aada8b22e88fdd3d33ffadd154c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Thu, 1 Aug 2024 19:28:41 +0800 Subject: [PATCH] zhconv --- LunaTranslator/LunaTranslator/translator/sakura.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/LunaTranslator/LunaTranslator/translator/sakura.py b/LunaTranslator/LunaTranslator/translator/sakura.py index c3c41809..d860cc2f 100644 --- a/LunaTranslator/LunaTranslator/translator/sakura.py +++ b/LunaTranslator/LunaTranslator/translator/sakura.py @@ -1,6 +1,6 @@ from translator.basetranslator import basetrans import requests -import json +import json, zhconv # OpenAI # from openai import OpenAI @@ -106,6 +106,8 @@ class TS(basetrans): content = "" gpt_dict_raw_text = self.make_gpt_dict_text(gpt_dict) + if self.needzhconv: + gpt_dict_raw_text = zhconv.convert(gpt_dict_raw_text, "zh-tw") content += "根据以下术语表(可以为空):\n" + gpt_dict_raw_text + "\n\n" content += (