提示词全部改为英文
This commit is contained in:
@@ -24,28 +24,26 @@ class GlossaryAgent(Agent):
|
|||||||
self.to_lang = config.to_lang
|
self.to_lang = config.to_lang
|
||||||
self.system_prompt = f"""
|
self.system_prompt = f"""
|
||||||
# Role
|
# Role
|
||||||
You are a professional machine translation engine.
|
You are a professional glossary extractor
|
||||||
# 角色
|
|
||||||
你是一个专业的术语表提取器
|
|
||||||
|
|
||||||
# Task
|
# Task
|
||||||
你会收到一个json格式的段落表,其中键是段落的序号,值是段落的内容。
|
You will receive a JSON-formatted list of paragraphs where keys are paragraph numbers and values are paragraph contents.
|
||||||
你需要从这些段落中提取**人名**和**地名**,并翻译这些名词为{self.to_lang}语言。
|
You need to extract **person names** and **location names** from these paragraphs and translate these terms into {self.to_lang}.
|
||||||
最终输出一个名词原文:名词译文的术语表
|
Finally, output a glossary of original terms:translated terms
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
- 特殊标签、形如`<ph-xxxxxx>`的标签不要添加到术语表
|
- Do not include special tags or tags formatted as `<ph-xxxxxx>` in the glossary
|
||||||
- 输出术语表的src必须与名词原文完全一致,dst是该名词的{self.to_lang}的译文
|
- The src in the output glossary must exactly match the original term, while dst is the {self.to_lang} translation of the term
|
||||||
- 相同的src仅在术语表中添加一次,不能重复
|
- The same src should only appear once in the glossary without repetition
|
||||||
|
|
||||||
# Output
|
# Output
|
||||||
输出格式是列表的json纯文本
|
The output format should be plain JSON text in a list format
|
||||||
{[{"src": "<名词原文>", "dst": "<名词译文>"}]}
|
{[{"src": "<Original Term>", "dst": "<Translated Term>"}]}
|
||||||
|
|
||||||
#示例
|
# Example
|
||||||
## 输入(翻译为中文):
|
## Input (translating to Chinese):
|
||||||
{{"0":"Jobs likes apples","1":"Bill Gates is sunbathing in Shanghai."}}
|
{{"0":"Jobs likes apples","1":"Bill Gates is sunbathing in Shanghai."}}
|
||||||
## 输出
|
## Output
|
||||||
{r'[{"src": "Jobs", "dst": "乔布斯"}, {"src": "Bill Gates", "dst": "比尔盖茨"}, {"src": "Shanghai", "dst": "上海"}]'}
|
{r'[{"src": "Jobs", "dst": "乔布斯"}, {"src": "Bill Gates", "dst": "比尔盖茨"}, {"src": "Shanghai", "dst": "上海"}]'}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ class Glossary:
|
|||||||
|
|
||||||
def append_system_prompt(self, text: str):
|
def append_system_prompt(self, text: str):
|
||||||
flag = False
|
flag = False
|
||||||
prompt = "\n以下为参考术语表:\n"
|
prompt = "\nHere is the reference glossary:\n"
|
||||||
for src, dst in self.glossary_dict.items():
|
for src, dst in self.glossary_dict.items():
|
||||||
if src in text:
|
if src in text:
|
||||||
prompt += f"{src}=>{dst}\n"
|
prompt += f"{src}=>{dst}\n"
|
||||||
flag = True
|
flag = True
|
||||||
prompt += "术语表结束\n"
|
prompt += "Glossary ends\n"
|
||||||
if flag:
|
if flag:
|
||||||
return prompt
|
return prompt
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user