uttrflow / uttrflow/uttrflow-swift

Self-corrections are never applied when the recogniser writes the trigger as its own sentence ("Tuesday. Scratch that. Wednesday")

Open
#565 0 comments 0 reactions 0 assignees View on GitHub
area:dictation bug P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

Whisper often writes a paused trigger phrase as a separate sentence. `Restatement` refuses to reach across a sentence end (`endsSentence`, `Sources/UttrflowCore/Cleaning/Restatement.swift:46-50, 66, 70-72`), which is right for real sentences (#199) but means these corrections are never applied.

From `uttrflow-dev bench` on main, synthetic clips (shipping and rules gave the same text unless noted):

| Clip (said) | Recogniser | Inserted |
|---|---|---|
| "Meet me on Tuesday, scratch that, Wednesday at noon." US voice | `Meet me on Tuesday. Scratch that. Wednesday at noon.` | unchanged |
| same, Indian English voice | `Meet me on Tuesday. Scratch that. Wednesday at noon.` | unchanged |
| "The total is forty dollars, no wait, fifty dollars." US voice | `The total is $40. No wait. $50.` | unchanged |
| same, Indian English voice | `The total is $40. No wait. $50.` | unchanged |
| same, UK voice | `The total is $40, no wait, $50.` | shipping `The total is $50.`, rules `The total is $$50.` (#550) |

So 4 of the 6 clips kept both halves because of the recogniser's full stops alone. (The "Tuesday … Wednesday" form also needs a shape match the rule does not make; that is by design in `Docs/cleanup.md` and not this issue.)

Reproduce the rules half without audio:

```
.build/release/uttrflow-dev clean --engine rules 'The total is $40. No wait. $50.'
```

## Why it matters

A trigger said with a pause is the most deliberate kind of self-correction, and the one a person is most sure they made.

## Acceptance criteria

- A sentence consisting only of a trigger phrase ("No wait.", "Scratch that.", "Sorry.", "I mean.") is read through as not ending a sentence, the way `PieceJoiner` already reads through a full stop at a piece seam (`Docs/cleanup.md`, self-correction row).
- A real sentence that happens to start with "No." ("No. We shipped it.") is not affected.
- Tests in `RestatementTests` / `SelfCorrectionPassTests`, and a corpus case with the trigger as its own sentence.

Contributor guide

Open the contributing guide

Research direction

Read Restatement.swift at lines 46-50, 66, and 70-72, then compare its sentence-boundary handling with PieceJoiner and Docs/cleanup.md. Reproduce the rules case with `.build/release/uttrflow-dev clean --engine rules 'The total is $40. No wait. $50.'`. Update the behavior and add coverage in RestatementTests, SelfCorrectionPassTests, and the corpus case while preserving real sentences beginning with “No.”.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
desktop, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.