Install
openclaw skills install @bjbook/zhz-english-learning英语陪练助手:从课文中提取单词、生成音频、创建互动学习页面(课文学习+单词测验+原文理解+句子测验)。Use when user asks to create English learning materials, vocabulary exercises, or 英语学习资料。
openclaw skills install @bjbook/zhz-english-learning从英文课文生成完整学习材料:单词列表、单词/课文音频、4 个互动学习页面(带侧边栏导航互相跳转)。
pip install edge-tts pydub
系统需安装 ffmpeg(pydub 用于拼接音频)。
从用户提供的英文课文中提取 5~20 个重点单词,保存到 md/words.md:
# 单词列表
| English | Phonetic | POS | Chinese |
|---------|----------|-----|---------|
| apple | /ˈæp.əl/ | n. | 苹果 |
| beautiful | /ˈbjuː.tɪ.fəl/ | adj. | 美丽的 |
python {baseDir}/scripts/generate_word_audio.py -w md/words.md -o sounds
每个单词生成 3 个音频文件到 sounds/ 目录:
{word}_male.mp3 — 男声英文朗读{word}_female.mp3 — 女声英文朗读{word}_chinese.mp3 — 女声中文释义同时生成 words.mp3 合集(顺序:男声→女声→中文,单词间有停顿)。
python {baseDir}/scripts/generate_text_audio.py --textfile txt/lesson.txt -o sounds/lesson.mp3
可选参数:-r "-15%" 调整语速,-v VOICE 指定音色。
agent 根据课文生成中文翻译文件 txt/translation.txt。
python {baseDir}/scripts/generate_lesson_page.py -t txt/lesson.txt -a sounds/lesson.mp3 -o lesson.html --translation txt/translation.txt
生成 lesson.html:左侧导航栏 + 展示原文 + 音频播放器(带倍速控制)+ 中文翻译。
python {baseDir}/scripts/generate_word_quiz.py -w md/words.md -s sounds -o quiz.html
生成 quiz.html,包含 4 种测验模式:
| 模式 | 说明 |
|---|---|
| 听音选义 | 播放英文发音两遍(男声→女声),选择中文含义(四选一) |
| 英文选义 | 显示英文单词,选择中文含义(四选一),播放发音两遍 |
| 中文选义 | 显示中文含义,选择英文单词(四选一),播放发音两遍 |
| 默写单词 | 显示中文含义,输入英文单词,提交后播放发音两遍 |
agent 根据课文生成题目 JSON 文件 json/reading_questions.json,格式:
[
{
"type": "choice",
"question": "What did the boys come out to do?",
"options": ["A. Play football", "B. Blow bubbles", "C. Feed the cat", "D. Wash the door"],
"answer": 1,
"explanation": "原文:The boys have come out on the porch to blow bubbles."
},
{
"type": "judge",
"question": "The bubble burst when it landed on the cat's back. (True/False)",
"options": ["True", "False"],
"answer": 1,
"explanation": "原文说 'does not burst',泡泡没有破裂。"
}
]
type: "choice"(单选题)或 "judge"(判断题)answer: 正确选项的索引(从 0 开始)explanation: 可选的解析说明python {baseDir}/scripts/generate_reading_quiz.py -q json/reading_questions.json -o reading_quiz.html
agent 根据课文生成句子练习 JSON 文件 json/sentence_questions.json,格式:
[
{
"type": "fill",
"sentence": "The boys have come out on the porch to blow ___.",
"word_bank": ["bubbles", "soap", "mat", "door"],
"answer": ["bubbles"],
"explanation": "原文:to blow bubbles(吹泡泡)"
},
{
"type": "transform",
"original": "The old cat is asleep on the mat.",
"hint": "将 'asleep' 替换为 'sleeping',使用现在进行时:",
"options": [
"The old cat is sleeping on the mat.",
"The old cat sleep on the mat.",
"The old cat was sleep on the mat.",
"The old cat sleeping on the mat."
],
"answer": 0,
"explanation": "is asleep → is sleeping,使用 be + V-ing 结构。"
}
]
type: "fill"(搭配填空)或 "transform"(句型替换)sentence 中用 ___ 表示填空位,word_bank 是备选词,answer 是按顺序的正确答案original 是原句,hint 是改写提示,options 是四选一选项,answer 是正确选项索引python {baseDir}/scripts/generate_sentence_quiz.py -q json/sentence_questions.json -o sentence_quiz.html
源文件按类型分别存放:
project/
├── md/ # Markdown 文件
│ └── words.md # 单词列表
├── txt/ # 纯文本文件
│ ├── lesson.txt # 课文原文(用户提供)
│ └── translation.txt # 中文翻译(agent 生成)
├── json/ # JSON 数据文件
│ ├── reading_questions.json # 原文理解题目(agent 生成)
│ └── sentence_questions.json # 句子练习题目(agent 生成)
├── lesson.html # 📖 课文学习页
├── quiz.html # 📝 单词测验页
├── reading_quiz.html # 📚 原文理解测验页
├── sentence_quiz.html # ✏️ 句子测验页
├── words.mp3 # 单词音频合集
└── sounds/ # 音频文件目录
├── {word}_male.mp3
├── {word}_female.mp3
├── {word}_chinese.mp3
└── lesson.mp3
所有 4 个 HTML 页面共享左侧导航栏,可直接点击跳转到其他页面:
lesson.html)quiz.html)reading_quiz.html)sentence_quiz.html)移动端自动变为顶部导航栏。
| 用途 | Edge-TTS 音色 |
|---|---|
| 英文男声 | en-US-GuyNeural |
| 英文女声 | en-US-JennyNeural |
| 中文女声 | zh-CN-XiaoxiaoNeural |