跳转到内容

实战范例:改善写作

这份范例演示如何使用 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-CN

输出:

此次部署将会延迟,因为我们在测试中发现了一个问题。

工作流程:先用中文写,再翻译

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

如果你需要用正在学习的语言写作,可以先用中文写好,再让 yaku 翻译并带上上下文:

Terminal window
echo "我们需要在下个 sprint 修这个 bug,不然会影响用户体验" | \
yaku --to en --context "team status update"

--context 选项可以在一个步骤中调整语气和正式程度——不需要先翻译再润色。

  • 不要过度润色。 如果原文已经很清楚,yaku 只会做最小幅度的修改。
  • --context 配合对象。 Slack 消息和客户 email 需要不同的正式程度。
  • 检查输出。 润色模式会让文字更自然,但请确认它仍然表达了你的原意。