uttrflow / uttrflow/uttrflow-swift

Hindi and Hinglish self-corrections ("nahi nahi", "matlab", "मेरा मतलब") are never applied, by the rules or by Apple's model

Open
#703 1 comment 0 reactions 0 assignees View on GitHub
area:dictation enhancement needs-info P2
Dominant language
Swift
Stars
4
Forks
17
Avg merge
3h 32m
Merged PRs (30d)
277

Description

## What happens

A Hindi speaker corrects themselves with "nahi nahi", "matlab", "मेरा मतलब", or the English "sorry" inside a Hindi sentence. Neither engine applies it.

**Rules.** The trigger list is English only (`Sources/UttrflowCore/Cleaning/Restatement.swift:4-8`). Also, `discardedStart` (`:40-67`) needs the first word after the trigger to repeat a word before it. Hindi puts the verb last, so the corrected slot comes first and the repeat never lines up:

```
$ uttrflow-dev clean -e rules "kal milte hain nahi nahi parso milte hain"
clean Kal milte hain nahi nahi parso milte hain.
$ uttrflow-dev clean -e rules "kal 4 baje sorry 5 baje milte hain"
clean Kal 4 baje sorry 5 baje milte hain.
```

The last one uses the English trigger "sorry" and has digits on both sides. It still isn't corrected, because the word before the trigger is "baje", not the number.

**Pipeline, measured.** `origin/main` 26d7bc1, Release `uttrflow-dev bench`, clips from `say -v Lekha`, 3 runs each with identical results:

| said | rules | Apple's model |
|---|---|---|
| मीटिंग चार बजे है, नहीं नहीं, पाँच बजे है। | मीटिंग चार बजे है, नहीं नहीं, पांच बजे है. | Meeting is at four o'clock, no no, five o'clock. |
| फ़ाइल [name A] को भेज दो, मतलब [name B] को भेज दो। | both halves kept | both halves kept, romanised |
| कल सुबह, सॉरी, परसों सुबह कॉल करना। | कल सुबह, सौरी, परशो सुबह, कॉल करना. | Kal subah, Sauri, parshon subah, call karna. |

Word error rate against the corrected sentence was 123% for the rules and 138% for the shipping router. Some of that comes from the recogniser, and the translation is #700. The correction itself was applied in 0 of 3 cases.

The model is asked for self-correction only through the English example "as a gift as a present" (#116 found it doesn't comply in English either).

## Why it matters

The English catalogue in `Docs/cleanup.md` promises that "Let's meet at four, no sorry, at five" arrives as the corrected sentence. Hindi and Hinglish speakers get both times, both names and the word "nahi" between them. "Meeting chaar baje, nahi nahi, paanch baje" is exactly the shape of the English case.

## Decision needed

"nahi" and "matlab" are also ordinary words ("nahi aaunga", "iska matlab hai"), so a rule trigger needs care. Options:

1. Trigger only on the doubled "nahi nahi" and on "मेरा मतलब"/"mera matlab" followed by a comma-like pause, and only for the number branch (a time or amount restated), which doesn't depend on word order.
2. Leave the rules alone and add a Hinglish restatement to the prompt's worked examples, measured with `make bakeoff`.
3. Both.

## Acceptance criteria

- The chosen option is implemented.
- `Tests/UttrflowAITests/Passes/SelfCorrectionPassTests.swift` covers "chaar baje nahi nahi paanch baje" and a "nahi aaunga" that must not trigger.
- Hinglish self-correction cases are in the clean-up corpus (#706).

Contributor guide

Open the contributing guide

Research direction

Start with Sources/UttrflowCore/Cleaning/Restatement.swift, especially the trigger list and discardedStart, then read Tests/UttrflowAITests/Passes/SelfCorrectionPassTests.swift. Compare the measured cases with the acceptance criteria and use make bakeoff for prompt-related changes. Done means the chosen option is implemented, the Hindi and Hinglish cases are covered, and ordinary "nahi aaunga" does not trigger.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
backend, internationalization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.