uttrflow / uttrflow/uttrflow-swift

A self-correction between two amounts leaves the first amount's symbol behind: "$40 no wait $50" becomes "$$50", "40% actually 50%" becomes "is% 50%"

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

Description

## What happens

`Restatement.discardedStart`'s number branch (`Sources/UttrflowCore/Cleaning/Restatement.swift:45-55`) removes the numeric half the speaker took back, but a currency sign before the number or a percent sign after it survives and is glued to the neighbouring word or to the replacement.

Reproduced on main with the rules alone (`uttrflow-dev clean --engine rules`):

| Input | Output |
|---|---|
| `The total is $40, no wait, $50.` | `The total is $$50.` |
| `The total is $40 no wait $50.` | `The total is $$50.` |
| `It costs $5 sorry $6.` | `It costs $$6.` |
| `The fee is 40% actually 50%.` | `The fee is% 50%.` |

This is what the recogniser actually writes. In the end-to-end bench (`uttrflow-dev bench`, synthetic clip "The total is forty dollars, no wait, fifty dollars.", UK voice) the recogniser produced `The total is $40, no wait, $50.` and the rules-only run inserted `The total is $$50.` Apple's model repaired it on the shipping route in that run, but the rules are the floor whenever the model declines, times out or is unavailable, so the broken text reaches users.

## Why it matters

It corrupts money and percentages, the values where a wrong character matters most, in exactly the case where the speaker was careful to correct themselves. The meaning guard does not catch it because the digits survive.

## How to reproduce

```
swift build -c release --product uttrflow-dev
.build/release/uttrflow-dev clean --engine rules 'The total is $40 no wait $50.'
```

## Acceptance criteria

- The discarded span includes a symbol attached to the discarded number (leading `$ € £ ₹`, trailing `%` and similar), so the four inputs above become `The total is $50.`, `It costs $6.` and `The fee is 50%.`
- Unit tests in `Tests/UttrflowCoreTests/RestatementTests.swift` and `Tests/UttrflowAITests/Passes/SelfCorrectionPassTests.swift` cover leading and trailing symbols.
- A corpus case in `Sources/UttrflowEval/EvaluationCorpus.swift` (with `mustNotAdd: ["$$"]` or equivalent) is added and listed in `RulesCorpusTests.rulesMustPass`.

Contributor guide

Open the contributing guide

Research direction

Start with the number branch of Restatement.discardedStart in Sources/UttrflowCore/Cleaning/Restatement.swift:45-55 and reproduce the examples with the rules-only clean command. Add coverage in Tests/UttrflowCoreTests/RestatementTests.swift and Tests/UttrflowAITests/Passes/SelfCorrectionPassTests.swift, then add the named corpus case in Sources/UttrflowEval/EvaluationCorpus.swift and RulesCorpusTests.rulesMustPass; done means leading and trailing symbols are removed with the discarded amount.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.