Files
CatoandClaude Opus 5.5 87f7e8bad9 feat(speaking): grammar and word-search feedback, and a claim may not outrun the product (#123)
* feat(speech): self-hosted grammar checker, and the client that says 'not checked' instead of 'clean'

LanguageTool 6.8 on the box, loopback-only and memory-capped
(scripts/box/provision-languagetool.sh). checkGrammar() returns null when
the checker is down — never [], which would tell a learner their German was
clean on the day the checker was off.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(speaking): grammar wired, hesitations located, and a claim may not outrun the product

GRAMMAR. The Swiss Standard German take is now checked by LanguageTool on
our own box, gated on mayJudgeForm (WER within the line), filtered to what a
listener would notice. null = not checked, never [].

WHERE YOU HESITATED. ai-kit 1.16.0 word timings name the word that came
after each long gap — usually the one being reached for. Deliberately NOT a
second fluency computation: #83 measures rate and pauses on the device from
the signal (the better clock), and two answers from two sources would
disagree on one screen. The server adds only what the device cannot know.

THE GUARD. capability.ts computed what was POSSIBLE and never asked what was
WIRED, so /technology claimed grammar while nothing called it. The new test
walks the import graph from app/ and requires every offered measure's module
to be reachable. It found a second bug on its first run: the "words" row
pointed readers at lib/variety/gate.ts, which never existed (now check.ts).
Proven by mutation: detaching grammar from the route fails it by name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* feat(speaking): grammar and hesitations on screen, and the upload the privacy page never listed

ON SCREEN. A Standard German take now shows what was said and what to say
instead ("den Buch → das Buch"), at most three, with "the first 3 of 5" when
there were more, and where the long pauses fell ("1.8 s before «Termin»").
Not-checked renders as a sentence, never as an empty space that reads as "no
mistakes". The checker's German explanations are deliberately not shown — they
would leak German prose into six other locales; the pair needs no translation.
The limit is printed beside the result: it catches agreement, case and verb
forms, not verb position after «weil» (measured on the box).

PRIVACY. /api/speaking/transcribe has uploaded Standard German takes to Groq
since the transcription mode shipped, and the privacy page had no row for it —
its code comment still said there was "no upload endpoint for takes". The
claim lived in a comment rather than a test, so nothing noticed it go false.
New flow `speakingTranscription` in all seven languages: only when you choose
Standard German, audio not kept by us, grammar checked on our own server.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(speaking): name hesitations from the signal's pauses, because Whisper swallows them

Tested on real audio before shipping: Commons recordings stitched as "Er hat
den [1.8 s] Buch gelesen", sent to Groq whisper-large-v3-turbo with word
timings. Text right, grammar error preserved — and NO gap between any words:
"Buch" came back as 1.84–4.14 s, stretched across the whole pause. Detecting
hesitations from word gaps would never have fired on real speech; the unit
tests passed only because their timings were idealised.

So measure() now records where each pause was (pauseSpans), the route returns
the word timings, and the page joins them: a pause belongs to the word still
being spoken when sound resumed. Same answer whether the recogniser leaves a
gap or swallows it — both shapes pinned, the second with Groq's exact output.

pauseSpans is a timeline of where someone went silent: needed on screen,
stripped on WRITE by withTake (it would otherwise have been persisted and only
dropped on read), with a test.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix(speaking): one file for what a pause means, after two thresholds contradicted each other on screen

A real take read: 'Längste Pause 1.8 s', then 'Keine langen Pausen', then the
new panel pointing at that 1.8 s. Each right by its own number. The three
lengths are different things — counts as a pause (250), searching for a word
(750), stuck (3000) — so they now live side by side in speech/pause.ts, and
the panel says 'Wo Sie nach einem Wort gesucht haben' rather than 'gezögert',
which sits honestly under 'you did not get stuck'. PauseSpan moved there too.

Verified by recording real Commons audio through the real UI via Chrome's fake
microphone at 390px and 1280px.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 01:54:56 -07:00
..