uttrflow / uttrflow/uttrflow-swift
AI suggestions must only ever write Latin-script English or romanised Hinglish
- Dominant language
- Swift
- Stars
- 4
- Forks
- 17
- Avg merge
- 3h 32m
- Merged PRs (30d)
- 277
Description
## The rule
Everything Uttrflow writes is English in the Latin alphabet. Hindi is written romanised, the way people type it ("haan thik hai"), never in Devanagari. Uttrflow is not a translator, and no other script is ever written by it.
## What happens today
AI suggestions can write text in other scripts in four ways. None of them is checked anywhere on the path from the model or the store to the screen.
1. **Model output is not filtered by script.** `SuggestionSession.drawable` (`Sources/UttrflowPredict/SuggestionSession.swift`) keeps any generated line that extends the typed text, and `MLXCandidateScorer.parse` keeps any line that echoes it. A Latin line continued in Devanagari, Arabic or Han is drawn.
2. **The prompt names no language.** `MLXCandidateScorer.instructions` asks the model to match the tone and register of the screen and the person's lines. With Devanagari on screen or in the person's earlier lines, that invites a Devanagari continuation.
3. **Fields typed in another script get suggestions.** A line typed in Devanagari is sent to the store and the model like any other. What comes back is either Devanagari, which Uttrflow must not write, or Latin glued onto Devanagari text.
4. **Remembered lines are offered back whatever their script.** Capture stores what the person typed, correctly, but `SuggestionSession.resolve` offers any stored line that matches, so a line the person once typed in Devanagari is later written by Uttrflow. The same goes for the person's earlier lines quoted in the prompt.
## Acceptance criteria
- A generated completion containing a letter, mark or digit outside the Latin script is never drawn. It is filtered where the model's lines are parsed and again where the session decides what is drawable.
- The model's instructions say to continue in English, or in romanised Hinglish where the person writes that, in the Latin alphabet only.
- A line containing non-Latin letters gets no suggestion at all, with its own `Quieting.Reason`, and neither the store nor the model is asked.
- A remembered or machine candidate containing non-Latin letters is never offered, and the person's earlier lines in other scripts are left out of the prompt.
- Latin with accents (café, naïve), emoji, symbols and punctuation are unaffected.
- Tests fail on the current code. `uttrflow-bakeoff complete --fixtures` shows no change in hits or in-register on the English fixtures.
- `Docs/predict.md` states the rule and why a non-Latin field is silent rather than completed.
Related: #712, #713, #715, #717, #719, #726. Several of those become "suppress suggestions in non-Latin fields" rather than "handle Devanagari better"; each thread gets a comment saying how.
Contributor guide
Assessment
This issue has not been assessed yet.