hex/android/app
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel 7c3f89bcb7 android: Labs › Automatic listens for the language (off)
Automatic dictated in one language it picked (the keyboard layout's, else
the phone's) and never listened, so speech in another language came out in
that one, which testers read as translation. With this lab on, Automatic
chooses among up to three languages: the keyboard's (kept unless the speech is
clearly another), the phone's other languages Hex dictates, then the last one
picked by hand. Bokmål and Nynorsk count as one; Danish and Swedish never.

whisper-language-choice.patch (applied at fetch time with -F0, so a bump it no
longer fits fails the build) runs whisper.cpp's detection step on the first
window the decode encodes anyway, at the app's window, takes a softmax over the
candidates only and writes the language and task into the decode's prompt: one
decoder step (about 3 ms on the host) instead of "auto"'s second, full-window
encoder pass (about 2 s). A switch takes 0.99 under 4 s of audio and 0.95 from
4 s. The text is formatted and inserted in the language chosen. Translate what
I say is offered while Spanish is a candidate; only Spanish is translated.
Faster English dictation isn't used while Automatic chooses among several
languages, and Dictation stops saying English uses it. With one language, or
the lab off, nothing is chosen and the decode is today's.

UI: with several candidates the Hex menu and Settings say "Automatic" and the
list's entry names them ("Automatic · English, Español"); #2749's "Automatic ·
English" stays otherwise. The Automatic entry now names Automatic's own
language even while another is picked by hand (it named the picked one).
Diagnostics' Last dictation adds the language, kept or switched, each
candidate's probability and the choice's time. New JNI entry point:
Java_ly_anoma_hex_speech_Whisper_language; imports unchanged.

The benchmark gains a guard: native.cpp's HEX_LANGS decodes each clip against
every other language with its own as the keyboard's, and score.py exits 1 on
any switch.

Verified: ./gradlew --max-workers=2 :app:testDebugUnitTest :app:assembleDebug
(282 tests; the NDK build applied the patch and passed check-imports). On the
host, a build of the pinned whisper.cpp with the repository's four patches
decoded the benchmark's 40 clips and 30 long ones byte for byte as one with the
three (app window and full window); the guard kept the clip's language in 630
of 630 pairs (and fails on a planted switch); with two candidates and the
keyboard's language kept, 80 of 80 texts matched the one-language decode; the
2,466-cut table, read through the patch's API, had 0 wrong switches at every
length (1.5-10 s, pairs and triples) and caught the other language 84.3% at
2 s and 99.1% at 5 s. All voices synthetic; not yet run on an emulator.
2026-11-24 21:21:58 -05:00
..
src android: Labs › Automatic listens for the language (off) 2026-11-24 21:21:58 -05:00
build.gradle.kts Android: Hex words files (Word replacements, review sheet, export) (#2781) 2026-11-24 19:42:04 -05:00
proguard-rules.pro Android: faster English dictation (Labs) (#2704) 2026-11-24 13:36:38 -05:00