跳转到内容

上下文提示

--context 选项告诉 LLM 你正在翻译什么内容,帮助它解决歧义词汇并选择合适的术语。

Terminal window
yaku --to zh-CN --context "Kubernetes 文档" -f guide.en.md

yaku 会将以下内容附加到系统提示词:

Context: this text is about Kubernetes 文档. Use appropriate domain terminology.

没有上下文时,LLM 仅从文字本身推测领域。这对大多数翻译都够用,但有些词汇在不同领域有不同意思:

英文词汇一般翻译搭配 --context "networking"搭配 --context "swimming"
pool资源池游泳池
port端口网络端口海港
table桌子路由表桌子
branch分支分支(git)树枝
Terminal window
yaku --to zh-CN --context "PostgreSQL database administration" -f backup-guide.en.md

LLM 会使用数据库专用术语:“事务”、“索引”、“查询”——而非一般用途的对等词。

Terminal window
yaku --to zh-CN --context "formal business email to a client" -f email-draft.en.txt

LLM 会调整为正式语气,使用适合商务沟通的简体中文措辞。

Terminal window
yaku --to zh-CN --context "medical research paper, cardiology" -f abstract.en.md

LLM 会使用标准医学术语,而非口语化的替代说法。

--context 设置整体领域,再用术语表锁定特定词汇:

Terminal window
yaku --to zh-CN \
--context "Kubernetes documentation" \
--glossary k8s-terms.yaml \
-f guide.en.md

术语表锁定确切词汇(例如 “pod” → “Pod”),而 --context 引导 LLM 处理其余内容。

在润色模式中,--context 可调整语气和正式程度:

Terminal window
echo "The server go down again yesterday and we need to fixe it ASAP" | \
yaku --mode polish --to en --context "incident report for engineering leadership"

输出:

The server experienced an unplanned outage yesterday and requires immediate remediation.
  • 保持简短。 一个短语就够了:"Kubernetes docs""legal contract""casual blog post"
  • 尽量具体。 "PostgreSQL administration""database" 好。
  • 用来控制语气。 "formal email""casual chat" 之类的上下文会影响写作风格,不只是术语选择。