上下文提示
--context 選項告訴 LLM 你正在翻譯什麼內容,幫助它解決歧義詞彙並選擇合適的術語。
yaku --to zh-TW --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-TW --context "PostgreSQL database administration" -f backup-guide.en.mdLLM 會使用資料庫專用術語:「交易」、「索引」、「查詢」 — 而非一般用途的對等詞。
正式商業書信
Section titled “正式商業書信”yaku --to zh-TW --context "formal business email to a client" -f email-draft.en.txtLLM 會調整為正式語氣,使用適合商業溝通的繁體中文措辭。
yaku --to zh-TW --context "medical research paper, cardiology" -f abstract.en.mdLLM 會使用標準醫學術語,而非口語化的替代說法。
搭配其他功能
Section titled “搭配其他功能”上下文 + 術語表
Section titled “上下文 + 術語表”用 --context 設定整體領域,再用術語表鎖定特定詞彙:
yaku --to zh-TW \ --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"之類的上下文會影響寫作風格,不只是術語選擇。