SlowTalk:留在朋友手提電腦上的耐心語言導師
SlowTalk: a patient language tutor that never leaves my friend's laptop
SlowTalk 是為朋友打造的本機語言練習工具,透過 Ollama 運行 Gemma 3 (4B),對話文字和語音均留在手提電腦,不需帳戶或 API key。它提供語音輸入、慢速朗讀及修正提示;首次下載模型需連接互聯網,完成設定後可離線使用。作者指出,4B 模型可能漏掉錯誤,或提出不自然的修正。
This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend
What I Built
My friend [FRIEND] is learning [LANGUAGE] because [REASON]. When I asked what is hardest, the answer was speaking. [ONE SENTENCE IN THEIR WORDS, e.g. "I know the words, but I freeze when someone is waiting for me to answer."]
Most apps move too fast for that. People can make it feel risky. And every sentence you type into an online tutor is sent to someone else's server.
So I built SlowTalk, a practice partner for exactly one person. It does four things:
- Talks at their level. Replies are one to three short sentences in simple [LANGUAGE], and always end with an easy question about things [FRIEND] likes ([INTERESTS]).
- Corrects without shaming. If [FRIEND] makes a mistake, the tutor answers what they meant first. Then a small pink tip shows the corrected phrase and a one-line reason in English.
- Listens. Press Speak, say a sentence, and it becomes text they can fix before sending.
- Talks back slowly. Answers can be read aloud a little slower than normal speech.
Everything about [FRIEND] lives in one small file, friend.json: name, language, level, hobbies and goal. Change that file and you have a tutor for someone else.
Demo
[ONE LINE ABOUT WHAT THE VIDEO SHOWS, e.g. "A sentence with a small mistake, and the pink tip that follows."]
Code
SlowTalk
A patient practice partner for one friend learning a language. It runs an open-weight model locally through Ollama, so there is no account, no API key, no cost, and no internet needed after setup. Nothing the friend types ever leaves the laptop.
Run (Windows)
- Install Python 3.11+ (tick Add python.exe to PATH).
- Install Ollama, then in PowerShell:
ollama pull gemma3:4b - Edit
friend.json(name, language, level, interests). - Double-click
run.bat.
Make it theirs
Everything personal lives in friend.json. Change model to try any model you have pulled with Ollama.
The tutor's behaviour is the prompt in build_prompt() in app.py.
To run it on Windows: install Python and Ollama, run ollama pull gemma3:4b, then double-click run.bat.
How I Built It
The brain: Gemma 3 (4B) through Ollama. A small Flask server sends the conversation to Ollama's chat endpoint and streams the answer back to the browser word by word.
The tutor is just a prompt. On startup, build_prompt() reads friend.json and writes the tutor's rules: reply in the target language, keep it short, end with a question, never shame. The corrections use a simple trick. The model is told to put any correction on a final line that starts with TIP:. The page splits the text on that marker and draws the pink callout. I chose this over JSON output because it keeps streaming smooth.
Voice in: Whisper, running locally. The browser records a clip and sends it to Flask. faster-whisper (the base model, on CPU) turns it into text. I force it to listen for the target language so an accent isn't mistaken for English. The text lands in the input box instead of being sent automatically, so [FRIEND] can fix a misheard word.
Voice out: the browser's built-in speech synthesis at 0.85 speed, using the voices already installed on the laptop.
The rest: plain HTML, CSS and JavaScript with no build step. The conversation is saved in the browser's local storage, and run.bat sets up everything on Windows.
Limits I know about:
- A 4B model can miss a mistake, or "correct" something that was fine. The tip is a suggestion, not a teacher's verdict.
- Whisper listens only for the target language, so English requests like "translate that" have to be typed.
- The first start downloads the models, so it needs internet once.
Why Does Open Innovation Matter?
Privacy is the point. [FRIEND] is nervous about speaking. A tutor that sends their voice to a company is a bad fit for that. With open models, the text and the audio never leave the laptop.
Nothing to sign up for. There is no account, no API key and no bill. I could hand over a folder and it just worked. It also keeps working when the Wi-Fi doesn't.
I could shape it. Swapping the model is one line. The Whisper size is one setting. The tutor's personality is a paragraph I can rewrite. A closed API would have given me none of that control.
Where closed would win: a bigger hosted model would probably give better corrections. For this project, privacy and zero cost mattered more than the last bit of accuracy.
What [FRIEND] Said
I handed Priya the laptop and kept quiet. She practiced for about 12 minutes,
and her first message was just "Hola, me llamo Priya", to see what would happen.
When I asked what she thought, she said: "It's the first time I didn't
feel stupid for getting the verb wrong."
What surprised me: she turned on Read aloud within a minute and kept
repeating the tutor's sentences back to herself. I never told her to do that.
What didn't work: twice, the tutor missed a mistake I could see on the
screen. Once, my Spanish-speaking cousin said a "corrected" phrase sounded
unnatural. The speech-to-text also turned "tengo" into "tenso" when she
spoke fast.
What I changed after: I set whisper_model to small, which fixed the
"tengo" problem. I haven't fixed the missed mistakes. That is the limit of
a 4B model.
來源:DEV Community · dev.to