mirror of
https://github.com/bitbaum/heidi.git
synced 2026-12-04 05:37:48 +01:00
* fix(speaking): a Standard German take is not corrected as dialect The take route received no variety, so a Standard German sentence spoken in the Standard German mode went through the dialect gate and the dialect rewrite: "nicht" came back as a foreign form to replace with "nöd". The client now sends the variety, the route stops before the gate and the model for a bridge take, and the check button is offered in the dialect mode only. Dialect mode is unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(speaking): a take stops by itself after two minutes, and the recorder reads what the browser did lib/domain/speaking/recording.ts holds the capture constraints, the limit and the stop decision. Noise suppression and echo cancellation are asked off; automatic gain stays on because, measured, speech 40 dB down reads -52.8 dBFS with gain off against the -45 floor and would be refused. The take is kept as an in-memory object URL for the learner's own playback, never stored or sent, and revoked on the next take, reset and unmount. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(speaking): the pure halves of playback, tasks, the meaning check, the ladder and the one next step timeline.ts turns pause spans into bar segments and a tap into a time. tasks.ts builds tasks from the situation packs' "say" lines, shown as their meaning. meaning.ts reads a yes/partly/no verdict and holds its missing points to the task's own. ladder.ts adapts a signal measurement to speechkit's attempt and reports a rate trend only when there are words. advice.ts picks one next action. A take's limit may be shorter than the ceiling. No pronunciation score anywhere. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(speaking): hear your own take again, with your pauses drawn on the bar take-playback.tsx plays the take from the page's memory in both varieties, draws the measured pause spans as lighter stretches and seeks on a tap or an arrow key. Nothing is sent, stored or rated. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * refactor(speaking): the practice screen is a composition of pieces under 300 lines; an engine nothing called is removed No behaviour change. speaking-practice.tsx (995 lines) becomes a 130-line composition over _components/speaking/*: use-take, use-heard and seven views, moved with their comments. The wired tests read the pieces as one text. Deleted, unused outside tests: feedbackFor and Feedback, and the typed-text mapping in lib/voice/correction.ts (corrections, canCorrectVariety, Origin, Silence, CorrectionResult) with its test. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T * feat(speaking): a take can answer a task, is told whether the meaning got across, and gets one next step Tasks come from the situation packs' "say" lines, shown as their Standard German meaning. The verdict (yes, partly, no, and the first missing point) rides in the dialect take's existing model call on the typed sentence; in Standard German it is one call on request, about the meaning only. The route finds the task by id, so no task text arrives from the browser. advice.ts picks one next action; "Nochmal, kürzer" climbs speechkit's pocket ladder and the recorder stops at the step's limit. The task's own line is shown after the attempt: a labelled machine voice in Standard German, text only in the dialect, where the pack has no voice. Takes gain optional variety, taskId, ladder and meaning. No pronunciation score. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019MDtmvb6xi489TfZMg7n9T --------- Co-authored-by: Claude <noreply@anthropic.com>
67 lines
3.4 KiB
TypeScript
67 lines
3.4 KiB
TypeScript
/**
|
|
* Whether, and how, to correct what the learner produced.
|
|
*
|
|
* Correction is the feature every language product ships and almost every one
|
|
* gets wrong, in one of two directions. Correct nothing and the learner
|
|
* repeats a mistake until it sets. Correct everything and they stop
|
|
* volunteering anything, which removes the production the correction was for.
|
|
* So it is a SETTING, defaulting to the middle.
|
|
*
|
|
* Three rules sit above the setting and cannot be turned on by it. Each one
|
|
* is here because the alternative is not merely unhelpful, it is false.
|
|
*
|
|
* 1. SPELLING IS NEVER CORRECTED. §6 already binds this for the text gate and
|
|
* the reason is the language, not our politeness: Zurich German has no
|
|
* standard orthography. `nöd`, `nööd` and `nid` are choices a native writer
|
|
* makes. Telling somebody their spelling is wrong in a variety that has no
|
|
* right spelling is inventing an authority and then enforcing it.
|
|
*
|
|
* 2. PRONUNCIATION IS NEVER SCORED. §8 forbids "93% native pronunciation" as
|
|
* speech-score theatre, and the pipeline makes the ban structural rather
|
|
* than principled: what arrives here is TEXT, produced by a recogniser.
|
|
* Notice that this module takes no audio, no confidence values and no
|
|
* phoneme alignment — there is nothing to score with. Adding a number would
|
|
* mean inventing one.
|
|
*
|
|
* 3. A TRANSCRIPT'S FORMS BELONG TO THE MACHINE, NOT THE SPEAKER. This is the
|
|
* one that is easy to get wrong, and it silently ruins the feature. Swiss
|
|
* German speech recognition — §7, and the /technology page's numbers —
|
|
* transcribes dialect INTO Standard German, because that is what every
|
|
* corpus was built to do. So a learner who says a sentence in flawless
|
|
* Zurich German gets back a Standard German transcript containing `ist`
|
|
* and `nicht` and very possibly a `ß`, none of which they said. Running the
|
|
* variety gate over that flags the RECOGNISER and bills it to the learner:
|
|
* they would be corrected, confidently and in detail, for saying something
|
|
* correctly. Nothing in the transcript is evidence about which forms they
|
|
* used, so nothing in the transcript may be corrected for its variety.
|
|
*
|
|
* Rule 3 leaves a real gap and the honest thing is to name it rather than
|
|
* paper over it: Heidi cannot tell a learner whether they SPOKE good Zurich
|
|
* German. Nothing can, reliably, today. What she can do with speech is
|
|
* understand it and answer — which is the thing the learner actually came for,
|
|
* and is what §2 calls exposure that does not withdraw.
|
|
*/
|
|
|
|
export type CorrectionLevel =
|
|
/** Say nothing. For somebody who wants to be understood, not taught. */
|
|
| "off"
|
|
/**
|
|
* Only what is not a form of the language at all. The default: it catches
|
|
* the things that would be wrong in any Swiss German, and stays silent on
|
|
* every regional judgement, which is where confident correction is most
|
|
* often simply provincial.
|
|
*/
|
|
| "blocking"
|
|
/**
|
|
* Also forms belonging to another variety — Bernese in a Zurich sentence.
|
|
* For somebody deliberately working on Zurich German specifically, and
|
|
* still never spelling, and still never pronunciation.
|
|
*/
|
|
| "all";
|
|
|
|
export const DEFAULT_CORRECTION: CorrectionLevel = "blocking";
|
|
|
|
export function isCorrectionLevel(value: unknown): value is CorrectionLevel {
|
|
return value === "off" || value === "blocking" || value === "all";
|
|
}
|