Skip to content

fix: a rendering learnt from ordinary words no longer rewrites every use of them - #388

Merged
znat merged 8 commits into
feat/syrinx-disfluencyfrom
fix/case-rule-on-words
Nov 2, 2026
Merged

znat merged 8 commits into
feat/syrinx-disfluencyfrom
fix/case-rule-on-words

Conversation

@znat

@znat znat commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

A rendering a correction learnt from ordinary words no longer becomes a blind rule. Before, correcting "resend" to Resend once wrote heard: resend, and every later "resend" was the product. The same held for heard: quand on under Qonto, we send under Resend, Mr under Mistral. Now a rendering whose every word a word list knows is not a rule. Each place it stands goes through the slot check and the clause decider, like a sound place. A rendering with an unknown word (Conto, vercel, N'gozy) or a pattern in slashes is still a rule. No setting. Review VocabularyPass.ordinary, VocabularyPass.wordParts and CorrectionRecording.term(named:) first.

before after
"Can you resend me the invite?" after the correction Resend resend (slot: VERB)
"Je viendrai quand on aura fini.", heard: quand on, no parser Je viendrai Qonto aura fini. unchanged
"Quand on aura fini, on partira.", with the parser quand on aura fini (capital lost on revert) unchanged
"It is an honor to be here.", heard: Honor under Hono, with the parser It is an Honor to be here. unchanged
"with resend", before any correction left, no place offered on the pill
"post hog", "PG vector", with the parser offered cold, written warm same
"post hog", "PG vector", no parser PostHog, pgvector left as heard
"J'ai payé avec Conto hier.", "on vercel" Qonto, Vercel same
Why it happened: the rule fires before any gate

Config.vocabularyRules turns every heard: rendering into an exact rule. With the parser, the clause decider then reads the rule's place. But when it does not write, the revert puts back the rendering, not what was heard: "Quand on" comes back as "quand on", "honor" as "Honor". Without the parser, the decider declines and an open rule place keeps what the rule wrote.

A case-only rendering was worse. SoundGroup.openings skips a rendering equal to the term's own spelling, so resend under Resend was a rule. VocabularyPass.ruleParts then counts the term and the rendering at the same span, finds two marks for one word, and gives up. So no place reached any gate.

Before any correction, the other gatherers skip a word that is already the term (fuzzyParts, and phonemeParts through spelled), so "with resend" had no place at all.

The change: one predicate, one gatherer, one lookup
  • VocabularyPass.ordinary: every word is in a word list (Vocabulary.unseenWord, the same lists as the vocabulary gate, so no language branch). A pattern in slashes, or a token with no letter (404), is never ordinary.
  • Config.vocabularyRules drops an ordinary rendering. The near-miss pass still reads every rendering (Config.renderingRules), so "Praise's" reaches heard: Praises with the sound pass off.
  • VocabularyPass.wordParts gathers every place an ordinary rendering stands, and every place the term's own spelling stands in another case when that spelling is ordinary. Each is a .sound part proposing the term inflected like the span (bill's reads Bill's), so settle asks the word lists and the slot, and the clause decider reads the rest. It runs after the sound pass, and longer forms go first, so BetterStack keeps "better stack" and Stack Overflow keeps "stack overflow" from Stack.
  • A rendering is read in its own language only (lang:, with the same fallback as the sound pass), so a French we send opens no place in English.
  • It gathers before any correction too. A cold term never writes, so the place is offered or left.
  • CorrectionRecording.term(named:) no longer reads "resend" as Resend (VocabularyPass.onlyCases). Keeping "resend" on the pill now records a counter. It recorded a use before, and the next "drizzle" was written. Correcting Resend back to "resend" now records a counter too. Before, it was read as a capital fix and recorded nothing. Bill corrected to "bill's" is a counter as well. Before, it created a person bill's.
  • floor: off keeps its meaning: never matched by sound. Its ordinary renderings are places, not rules, like any other term's.
The cost: no parser, no split-term write

Without the parser, the clause decider cannot run. A rendering of known words is then left as heard, including the right ones: "post hog" stays "post hog". Before, the rule wrote it, and also wrote "Je viendrai Qonto aura fini.", "Resend the invoices monthly." and "Mistral Smith will call you.".

Probe on 9 sentences, cold and warm (4 --for uses), with and without the parser, before (fcdba97) and after (3a50af4):

  • With the parser: no write decision changes. 6 outputs change, all capitals the revert used to break.
  • Without the parser: 16 outputs change. 10 wrong writes are gone ("Je viendrai quand on", "Quand on aura fini", we send, Mr, honor; cold and warm). 6 right writes are gone (post hog, PG vector, "payé avec quand on"; cold and warm).
Cold places: offered, because a cold term never writes

Measured on the Kokoro try-out at 750deb0, both ways on the same build:

  • Without cold places: lines 24 and 25 ("with resend", "in linear") are missed until the user corrects them.
  • With cold places: both are offered. One ordinary noun is offered ("drizzle the tickets"). No wrong write. The slot refuses the verb and adjective traps (lines 27, 28, 29).
  • One No on that offer records a counter. The next two "drizzle" sentences are then left (p 0.004 and 0.034).

The 165 bench has no case-only span, so it cannot weigh this either way.

Verification: checks, probes, and what was measured on which commit
  • check-clause-places 20/20, check-vocabulary-config 64/64, check-selector 21/21, check-sound-group 62/62, check-serve 32/32, check-pipeline 139/139, check-replacements 23/23, check-learn 45/45, check-possessive 35/35, on f014423. The other text-level CI scripts pass locally too.
  • Red first. On 750deb0, the cases added for the review comments fail (6 of 18). On fcdba97, 4 of the cases added or changed for ordinary renderings fail: "Je viendrai quand on aura fini." comes out "Je viendrai Qonto aura fini." with no parser, "Quand on" loses its capital, and cloud under a floor: off Claude counts as a rule. On 824ca7a, the 3 cases added for the second review fail (near miss with the sound pass off, 404, bill's).
  • Fixtures changed on purpose. 15 check-pipeline cases used "super base" or "Versailles" as a rule to test something else (vars, context, input, rule attribution). They now use "super baze" and "Vursel", which are still rules. 4 check-vocabulary-config loading fixtures moved from Versailles/Prissy to Vursel/Prissie for the same reason. Two floor: off cases now expect cloud to be no rule. check-learn uses clowd for the same reason. check-replacements runs with no parser, so "It runs on super base now" and "Mick" are now left as heard; the file records it, and the composed dotted-path case uses "super baze".
  • fuzzyParts reads the rules, so an ordinary rendering no longer has near misses. "She deserves Praise's work" still opens a place under heard: Praises: the sound pass finds it.
  • 165 English bench, floor 0.60, --serve, chrono plus 20 random orders, on 750deb0: identical before and after, 0 of 3465 decisions differ. Not re-run on the later commits: the harness was lost in a reboot. The bench has no ordinary-word rendering with a case-only span, but it may hold other ordinary renderings, so this number does not cover 3a50af4.
  • Kokoro try-out, on 750deb0, whole script replayed from the starting vocabulary. Lines 24 and 25: left, now offered. Lines 28 and 29: wrong write, now left. Line 38: one new wrong offer ("drizzle"). No other line changes.
  • Local CodeRabbit: 0 findings on fcdba97. One on 3a50af4 (the floor: off docs still called its renderings exact rules), fixed in 9e3d6d0, then 0. The remote review was rate limited, so the local review of the whole PR counts: 4 findings on 0fec463 (2 fixed in f014423, 2 dismissed, see the PR comment), then 0 on f014423.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2

znat and others added 2 commits November 2, 2026 11:58
check-clause-places.sh gets two cases. "resend" learnt under Resend must
not rewrite "Can you resend me the invite?". "upstash" learnt under
Upstash must still write Upstash. The first fails on the base: the rule
writes "Resend" and no gate sees the place.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
…e of it

A correction of "resend" to Resend wrote `heard: resend`, and that became
an exact rule. Every later "resend" turned into the product, and no gate
saw the place: ruleParts counts the term and the rendering at the same
span and gives up.

VocabularyPass.onlyCases names the case: only the letter case differs and
a word list knows the word. Such a rendering is no longer a rule.
caseParts gathers each place where the term stands in another case as a
`.sound` part, so the slot check and the clause decider settle it. A
non-word ("vercel", "upstash") stays a rule.

Places are gathered before any correction too. A cold term never writes,
so the place is offered or left.

CorrectionRecording.term(named:) no longer reads "resend" as Resend. So
keeping "resend" on the pill, or correcting Resend back to "resend",
records a counter instead of a use or nothing.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
@greptile-apps

greptile-apps Bot commented Nov 2, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository.

@znat

znat commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eebc0942-39e1-4dc0-a97f-5beccfd82ccb
Commits

Reviewing files that changed from the base of the PR and between 750deb0 and 9e3d6d0.

Files selected for processing: 18
  • Sources/ParrotFlow/Config.swift
  • Sources/ParrotFlow/CorrectionRecording.swift
  • Sources/ParrotFlow/Pipeline.swift
  • Sources/ParrotFlow/VocabularyPass.swift
  • docs/transcription.md
  • scripts/check-clause-places.sh
  • scripts/check-vocabulary-config.sh
  • tests/pipeline-cases.yaml
  • tests/pipelines/context.yaml
  • tests/pipelines/everything.yaml
  • tests/pipelines/input.yaml
  • tests/pipelines/review-off.yaml
  • tests/pipelines/vars-conditions.yaml
  • tests/pipelines/vars.yaml
  • tests/pipelines/vocabulary-learnt-words.yaml
  • tests/pipelines/vocabulary-rules-twice.yaml
  • tests/pipelines/vocabulary-rules-two-renderings.yaml
  • tests/pipelines/vocabulary-rules.yaml

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Vocabulary processing now distinguishes ordinary-word renderings from exact rewrite rules. It adds eligible word-based proposals after sound proposals and counts them with the other proposals. Correction handling accounts for case-only differences, including possessive stems. Documentation, scripts, and pipeline fixtures cover ordinary-word and unknown-word renderings, case-only places, and overlapping terms.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: Low · up to 9e3d6

Some vocabulary corrections may be missed or lose a possessive suffix. The change is mergeable with awareness of these localized regressions.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: ordinary-word renderings no longer become broad rewrite rules.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description clearly explains the behavior change, affected code, setting impact, review focus, verification results, and measured before/after effects. It is more detailed than the requested three…
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 6 files. (12 skipped: 12 unsupported.)

Full details: Description check

Explanation

The description clearly explains the behavior change, affected code, setting impact, review focus, verification results, and measured before/after effects. It is more detailed than the requested three-to-six-sentence opening and does not include the template checkboxes for make test, prompt or pattern scoring, or signed-off commits, but it is otherwise complete and relevant.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread Sources/ParrotFlow/Config.swift Resolved
Comment thread Sources/ParrotFlow/Pipeline.swift Resolved
Comment thread Sources/ParrotFlow/VocabularyPass.swift Resolved
Comment thread Sources/ParrotFlow/VocabularyPass.swift Resolved
…ot a rule

Answers four CodeRabbit comments on #388.

- `heard: Resend` under `Resend` was still a case-insensitive rule, so every
  "resend" became the product. `onlyCases` now holds when the spellings
  differ at most in case. `term(named:)` matches an exact spelling first.
- `--correction Bill "bill's"` created a person `bill's`. The possessive is
  now stripped before the case-only test, so it is a counter.
- Case places are gathered after the sound pass, so "stack" for `Stack` no
  longer takes "better stack" from `BetterStack`.
- Longer terms gather first, so "stack overflow" is `Stack Overflow`, not
  `Stack`.

check-clause-places: 18/18. On 750deb0 the new and changed cases fail
(12/18).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
@znat

znat commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

znat and others added 2 commits November 2, 2026 13:59
A correction can save a rendering of known words: `heard: quand on` under
Qonto, `we send` under Resend, `Mr` under Mistral. Each was an exact rule.
With the parser, the clause decider read the place, but a revert put the
rendering back, so "Quand on" became "quand on" and "honor" became "Honor".
Without the parser, the rule wrote every time: "Je viendrai Qonto aura fini."

Now any rendering whose every word a word list knows is not a rule.
`VocabularyPass.wordParts` (was `caseParts`) gathers its places as sound
places, so the slot and the clause decider read them. A rendering with an
unknown word (`Conto`, `N'gozy`) and a pattern in slashes stay rules.

Cost: without the parser, "post hog" and "PG vector" are left as heard.
With the parser they are offered on a cold term and written on a warm one,
as before.

Test fixtures that used "super base" or "Versailles" as a vehicle for other
features now use "super baze" and "Vursel", which are still rules. Two
`floor: off` checks now expect `cloud` to be no rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
@znat znat changed the title fix: a capital learnt on an ordinary word no longer rewrites every use of it fix: a rendering learnt from ordinary words no longer rewrites every use of them Nov 2, 2026
@znat

znat commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Fix comments: Fix CodeRabbit comments on this PR

Comment thread Sources/ParrotFlow/Config.swift Resolved
Comment thread Sources/ParrotFlow/VocabularyPass.swift Resolved
Comment thread Sources/ParrotFlow/VocabularyPass.swift Resolved
znat and others added 2 commits November 2, 2026 14:16
check-replacements runs with no parser, so "super base" and "Mick" are now
left as heard. The case for "super base" records that. The composed case
uses "super baze", which is still a rule. check-learn uses `clowd` for the
old rendering so both renderings still count as rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
Answers three CodeRabbit comments on 9e3d6d0.

- The near-miss pass reads every rendering again (`Config.renderingRules`),
  so with the sound pass off "Praise's" still reaches `heard: Praises`.
- A rendering with a token that has no letter (`404`) is not ordinary, so it
  stays a rule.
- A word place proposes the term inflected like the span, so
  `heard: bill's` writes "Bill's", not "Bill".

Each has a check case that fails on 824ca7a.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
@znat

znat commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@znat

znat commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@znat

znat commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

From the local CodeRabbit review of the whole PR. `wordParts` took every
rendering, so a `lang: fr` rendering such as `we send` opened a place in an
English dictation. It now keeps the renderings of the dictation language,
with the same fallback as `Config.vocabularySounds`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
@znat

znat commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Local CodeRabbit review of the whole PR (coderabbit review --agent --base-commit 86a6eb71, the merge base with feat/syrinx-disfluency). This counts as the review for merging, since the remote review was rate limited.

Run 1, on 0fec463: 4 findings.

  1. Major, VocabularyPass.swift:428: wordParts should read renderings in the dictation language only, as Config.vocabularySounds does. Fixed in f014423. A lang: fr rendering we send opened a place in an English "We send the invoices monthly." Now it opens none. Check: "an ordinary rendering from another language opens no place" in tests/pipeline-cases.yaml (with lang: en the same sentence opens 1 place, so the case tells the two apart).
  2. Minor, VocabularyPass.swift:428: the same point as 1. Fixed in f014423.
  3. Major, Config.swift:791: a spell-check timeout reads as a known word, so it could drop a non-word rendering from the rules. Dismissed. NSSpellChecker cannot tell a timeout from a known word (documented on Replacements.isRealWord), so there is no inconclusive result to keep apart. The failure goes the safe way: the rendering becomes a place the slot and the clause decider read, not a wrong write. The vocabulary gate already reads the same lists with the same behaviour.
  4. Minor, VocabularyPass.swift:425-428: floor: off should also drop the heard renderings from wordParts. Dismissed. floor: off turns off matching by sound, not the renderings the user wrote down (Config.Vocabulary.Term.never, docs/transcription.md). Before this PR such a rendering was a rule; dropping it here would make the correction do nothing. The remote review accepted the same answer on the earlier thread.

Run 2, on f014423: 0 findings.

Checks on f014423: check-clause-places 20/20, check-vocabulary-config 64/64, check-selector 21/21, check-sound-group 62/62, check-serve 32/32, check-pipeline 139/139, check-replacements 23/23, check-learn 45/45, check-possessive 35/35.

@znat
znat merged commit 6bac2c9 into feat/syrinx-disfluency Nov 2, 2026
6 checks passed
@znat
znat deleted the fix/case-rule-on-words branch November 2, 2026 17:24
znat added a commit that referenced this pull request Nov 2, 2026
- pipelines.md: the heading said two fixed passes over a table of three.
  It is now "The fixed passes", and the links to it follow.
- configuration.md: names the tree cutter as the third fixed pass.
- cli.md: a one-shot run waits up to 2 s for a cached parser, so the
  clause decider runs without --warm. --warm reads the parser for a
  vocabulary step only when its clause decider can run.
- verify-parrotflow: since #388 "Versailles" is an ordinary word, so it
  is a place, not a rule. The example now expects changes = "".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WfxPEjc1EEGqG2rHoJcLJ2
Signed-off-by: Nathan Zylbersztejn <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant