hex/ios/HEXShared
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel e6319e98be
iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119)
* iOS: Hinglish romaniser, Hindi in Latin letters as people text it

Adds HinglishRomanizer and HinglishLexicon in HEXShared, so the app and
the keyboard share them, for the Hinglish experiment in the next commit.

Why: testers asked for Hindi dictation in the Latin alphabet ("kya kar
rahe ho"), not Devanagari and not translated. On macOS 27.2, Apple's
SpeechTranscriber hi-IN already writes Hindi in Latin letters, but
DictationTranscriber hi-IN (the module on iPhones without
SpeechTranscriber, and the fallback when its model won't install)
writes Devanagari, English words included (मीटिंग).

How:
- Devanagari words take the lexicon's spelling when it has them (about
  45 common Hindi words, 270 English loanwords back in English).
  Otherwise: Hindi schwa deletion, then ICU Devanagari-Latin, then casual
  spelling (no diacritics; aa/ee/oo only where stressed; ch, sh, w).
- Latin words (SpeechTranscriber) keep their words. A few Apple spellings
  change (mei -> main, hoo -> hoon, nahin -> nahi), and Apple's
  mid-sentence capitals on common Hindi words are lowered.
- Devanagari digits become 0-9, and a spoken hour before "baje" becomes
  digits ("paanch baje" -> "5 baje").

Verified: HinglishRomanizerTests (5 cases) pass in xcodebuild test on an
iOS 27.2 simulator. Word accuracy against the expected casual spelling,
over 45 synthesized Hinglish sentences (Lekha voice, macOS 27.2 Speech):
- DictationTranscriber output: 1.3% -> 82.1%
- clean Devanagari: 100%
- 30 held-out sentences: 100% (93.0% exact spelling)
Latency is about 0.01 ms per sentence (macOS -O) after a 3-6 ms first
call. It adds 0.7 MB in the simulator.

* iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default)

Settings › Experiments › Hinglish (Hindi in Latin letters). While it is
on, Hindi dictation is written in Latin letters the way people text it
("meeting kal 5 baje hai"), in the app and in-keyboard dictation alike.
Hindi is also offered in the Hex key's language menu and named
"Hinglish" there and in Settings › Dictation language.

- HinglishSettings (App Group key experiments.hinglish; the launch
  argument --experiment-hinglish turns it on in simulator scenes).
- DictationPipeline runs HinglishRomanizer as its first step, only for
  Hindi and only while the experiment is on. Learned fixes, custom
  vocabulary, the style (#2103) and Lowercase then work on the Latin
  words. The new Stages.heard (Latin for Hinglish) is what learning
  compares with the inserted text. It replaces the raw transcript, so
  Devanagari isn't learned against Latin edits.
- DictationController reads the setting when a capture starts, as it
  does for Lowercase. KeyboardLocalDictation reads it at transcription.
  Both stay string rules with no model, so the keyboard's memory guard
  (#2045) needs no new headroom.
- DictationLanguageSwitch: nativeName/nativeNames return "Hinglish" for
  hi while on, and choices(hinglish:) offers hi-IN after the recents
  when Apple Speech lists it. KeyboardViewController passes the setting
  and adds it to the menu's signature.
- AppleSpeechLanguages.options and DictationLanguageRow name Hindi
  "Hinglish" while on.
- zh-Hans strings for the new row. settings-*-on scenes turn it on. The
  keyboard fixture puts a --dictation-language missing from its list
  first, for the Hinglish menu scene.

Not changed: Apple Speech still picks the module (SpeechTranscriber for
hi-IN where available, which already writes Latin), and nothing changes
while the experiment is off.

Verified: xcodebuild test on an iOS 27.2 simulator (iPhone 17 Pro):
372 tests, 0 failures, 1 skipped. New tests:
- HinglishRomanizerTests.testStylesAndLowercaseApplyToHinglish
- DictationLanguageSwitchTests.testHinglishOffersHindiByThatName
Screenshots of settings-experiments-on, full-keyboard-languages
(--experiment-hinglish --dictation-language hi-IN) and
settings-dictation-on with hi-IN show the toggle, "Hinglish" ticked in
the Hex key's menu, and Dictation language "Hinglish".
2026-11-21 00:29:24 +00:00
..
FullKeyboard iOS: Auto-capitalization switch for the full keyboard (#2116) 2026-11-20 23:53:33 +00:00
TypingLog iOS: swipe typing for English and Spanish (Experiment, off by default) (#2106) 2026-11-20 22:30:53 +00:00
AppleIntelligenceCleanupSettings.swift ios: optional Apple Intelligence transcript cleanup (experiment) (#1538) 2026-11-08 08:07:11 -05:00
AppleSpeechModule.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
CleanupReconstruction.swift iOS: clean up what I say with an on-device tagger (experiment) (#2023) 2026-11-20 01:29:41 +00:00
CleanupTagger.swift iOS: dictation styles apply in the keyboard and read differently, plus Lowercase (#2103) 2026-11-20 21:47:04 +00:00
CleanupTokenizer.swift iOS: clean up what I say with an on-device tagger (experiment) (#2023) 2026-11-20 01:29:41 +00:00
CustomVocabularySettings.swift ios: custom vocabulary experiment (#1547) 2026-11-08 12:15:00 -05:00
DictationCorrections.swift ios: learn dictation and typing fixes from edits (Learn how I type) (#2022) 2026-11-20 01:04:58 +00:00
DictationEditInference.swift ios: learn dictation and typing fixes from edits (Learn how I type) (#2022) 2026-11-20 01:04:58 +00:00
DictationEditTracker.swift ios: learn dictation and typing fixes from edits (Learn how I type) (#2022) 2026-11-20 01:04:58 +00:00
DictationLanguage.swift iOS: several keyboard languages, switched on the space bar, with bilingual autocorrect (#2104) 2026-11-20 22:08:01 +00:00
DictationLanguageSwitch.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
DictationPipeline.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
DictationTranslation.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
DotScope.swift iOS: dictate from the keyboard without opening Hex, plus suggestions, autocorrect, and Paste (#1999) 2026-11-19 12:20:12 -05:00
DotScopeShader.metal fix(ios): eliminate handoff frame stalls and add overlapping ballistic swipe throw (t1153) (#757) 2026-10-31 22:14:22 -07:00
EmptyCapture.swift iOS: fix six TestFlight tester issues (audio error, leaked error text, Live Activity, haptics, capitals, push to talk) (#2035) 2026-11-20 13:21:16 +00:00
HexTheme.swift fix(ios): eliminate handoff frame stalls and add overlapping ballistic swipe throw (t1153) (#757) 2026-10-31 22:14:22 -07:00
HinglishLexicon.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
HinglishRomanizer.swift iOS: Hinglish dictation, Hindi in Latin letters (Experiment, off by default) (#2119) 2026-11-21 00:29:24 +00:00
HomeSwipeCue.swift fix(ios): eliminate handoff frame stalls and add overlapping ballistic swipe throw (t1153) (#757) 2026-10-31 22:14:22 -07:00
KeyboardBridge.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
KeyboardSurface.swift iOS: the keyboard starts listening on touch-down, with its capture page ready when it opens (#2089) 2026-11-20 20:04:35 +00:00
SpeechModelInstall.swift iOS: keep dictating English when its speech model was released, and say Open Hex instead of "no language" (#2090) 2026-11-20 20:06:14 +00:00
SpokenCleanupRules.swift iOS: dictation styles apply in the keyboard and read differently, plus Lowercase (#2103) 2026-11-20 21:47:04 +00:00
TranscriptFormatter.swift iOS: dictation styles apply in the keyboard and read differently, plus Lowercase (#2103) 2026-11-20 21:47:04 +00:00
UserFacingError.swift iOS: Simplified Chinese interface for the app, widgets and permission prompts (#2083) 2026-11-20 18:15:44 +00:00
VocabularySpelling.swift ios: custom vocabulary experiment (#1547) 2026-11-08 12:15:00 -05:00