上下文提示
--context 选项告诉 LLM 你正在翻译什么内容,帮助它解决歧义词汇并选择合适的术语。
yaku --to zh-CN --context "Kubernetes 文档" -f guide.en.mdyaku 会将以下内容附加到系统提示词:
Context: this text is about Kubernetes 文档. Use appropriate domain terminology.上下文何时重要
Section titled “上下文何时重要”没有上下文时,LLM 仅从文字本身推测领域。这对大多数翻译都够用,但有些词汇在不同领域有不同意思:
| 英文词汇 | 一般翻译 | 搭配 --context "networking" | 搭配 --context "swimming" |
|---|---|---|---|
| pool | 池 | 资源池 | 游泳池 |
| port | 端口 | 网络端口 | 海港 |
| table | 桌子 | 路由表 | 桌子 |
| branch | 分支 | 分支(git) | 树枝 |
yaku --to zh-CN --context "PostgreSQL database administration" -f backup-guide.en.mdLLM 会使用数据库专用术语:“事务”、“索引”、“查询”——而非一般用途的对等词。
正式商务邮件
Section titled “正式商务邮件”yaku --to zh-CN --context "formal business email to a client" -f email-draft.en.txtLLM 会调整为正式语气,使用适合商务沟通的简体中文措辞。
yaku --to zh-CN --context "medical research paper, cardiology" -f abstract.en.mdLLM 会使用标准医学术语,而非口语化的替代说法。
搭配其他功能
Section titled “搭配其他功能”上下文 + 术语表
Section titled “上下文 + 术语表”用 --context 设置整体领域,再用术语表锁定特定词汇:
yaku --to zh-CN \ --context "Kubernetes documentation" \ --glossary k8s-terms.yaml \ -f guide.en.md术语表锁定确切词汇(例如 “pod” → “Pod”),而 --context 引导 LLM 处理其余内容。
上下文 + 润色模式
Section titled “上下文 + 润色模式”在润色模式中,--context 可调整语气和正式程度:
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"之类的上下文会影响写作风格,不只是术语选择。