跳到內容

實戰範例:改善寫作

這份範例示範如何使用 yaku 的潤飾模式,寫出更清晰、更自然的文字 — 尤其是你正在學習的語言。

Terminal window
echo "I want to inform you that the deployment will be delay because of the issue we found in testing." | \
yaku --mode polish --to en

輸出:

I'd like to inform you that the deployment will be delayed due to an issue we found during testing.

使用 --context 設定正式程度:

Terminal window
# 給英文客戶的正式 email
echo "We found a bug and will fix it soon" | \
yaku --mode polish --to en --context "formal email to enterprise client"
# We have identified an issue and are working on a resolution. We will update you shortly.
# 日文的輕鬆 Slack 訊息
echo "CIまた壊れた、誰か見てくれない?" | \
yaku --mode polish --to ja --context "casual Slack message"
# CIがまた壊れました — 誰か確認してもらえますか?

當你要對英文專案發 PR 時:

Terminal window
cat <<'EOF' | yaku --mode polish --to en --context "GitHub pull request description"
This PR fix the issue where user input is not validate before send to API.
Also add test for new validation logic.
EOF

輸出:

This PR fixes the issue where user input is not validated before being sent to the API.
It also adds tests for the new validation logic.
Terminal window
yaku --mode polish --to en -f draft-blog-post.md -o polished-blog-post.md

對於 Markdown 檔案,yaku 會保留結構(標題、程式碼區塊、連結),只潤飾文字部分。

潤飾模式也適用於中文 — 用在重要的溝通場合很有幫助:

Terminal window
echo "這個部署會延遲因為我們在測試發現了一個問題" | \
yaku --mode polish --to zh-TW

輸出:

此次部署將會延遲,因為我們在測試中發現了一個問題。

工作流程:先用中文寫,再翻譯

Section titled “工作流程:先用中文寫,再翻譯”

如果你需要用正在學習的語言寫作,可以先用中文寫好,再讓 yaku 翻譯並帶上情境:

Terminal window
echo "我們需要在下個 sprint 修這個 bug,不然會影響使用者體驗" | \
yaku --to en --context "team status update"

--context 選項可以在一個步驟中調整語氣和正式程度 — 不需要先翻譯再潤飾。

  • 不要過度潤飾。 如果原文已經很清楚,yaku 只會做最小幅度的修改。
  • --context 配合對象。 Slack 訊息和客戶 email 需要不同的正式程度。
  • 檢查輸出。 潤飾模式會讓文字更自然,但請確認它仍然表達了你的原意。