uttrflow / uttrflow/uttrflow-swift

Removing a self-correction leaves the comma that closed it: "Send the file to Sam, before lunch."

Open
#564 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

When the recogniser punctuates a correction as a parenthetical, `SelfCorrectionPass` removes the discarded half and the trigger but keeps the comma after the replacement, which now separates nothing.

From `uttrflow-dev bench` on main (synthetic `say` clips from `Scripts/dictation_bench.py`, both the shipping route and rules only, identical):

| Clip (the corpus names are replaced here) | Recogniser | Inserted |
|---|---|---|
| `selfcorrection1-daniel` | `Send the file to Alex, I mean to Sam, before lunch.` | `Send the file to Sam, before lunch.` |
| `selfcorrection3-samantha` | `Book a table for six, actually eight, at the usual place.` | `Book a table for eight, at the usual place.` |

Reproducible without audio:

```
.build/release/uttrflow-dev clean --engine rules 'Send the file to Alex, I mean to Sam, before lunch.'
```

The bench's word error rate cannot see it (it drops punctuation), so the category reports 0.0% final.

## Why it matters

Two of the four self-correction clips in the bench corpus come out with a stray comma. It is small, but it is on every correction spoken with a pause on both sides, which is how people usually say them.

## Acceptance criteria

- When the discarded span began after a comma (or the trigger was set off by commas), the comma that closes the replacement is removed too, unless the sentence needs it (for example before a following clause that already had one).
- Tests in `Tests/UttrflowAITests/Passes/SelfCorrectionPassTests.swift` for both clips above.
- A corpus case with the comma form, listed in `RulesCorpusTests.rulesMustPass`.

Contributor guide

Open the contributing guide

Research direction

Start with SelfCorrectionPass and its tests in Tests/UttrflowAITests/Passes/SelfCorrectionPassTests.swift, then run the reproducible clean command from the issue. Add coverage for both shown corrections and a comma-form corpus case in RulesCorpusTests.rulesMustPass. Done means the replacement-closing comma is removed when it is stray, while required sentence punctuation remains.

Written by the indexing model from the issue text.

Assessment

Tech stack
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.