hex/android/app
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ryan Vogel dc41ff10c1
Android: dictate in Portuguese (#2562)
What changed
- DictationLanguage gains Português (pt): one entry for Brazil and Portugal,
  since Whisper has a single "pt" token and Hex has no regional rules. Like
  Nederlands it has no layout of its own, so the keyboard stays English
  QWERTY. It appears in Settings › Dictation language and in the Hex menu's
  language page (also reached by holding the space bar), and Automatic picks
  it on a phone whose languages include Portuguese (pt-BR, pt-PT).
- Mid-sentence dictation knows a short list of Portuguese function words, so
  "O ônibus" after "e" goes in lowercase; names keep their capital.
- README: the space-bar list, the Automatic rule and the scope line match the
  code again (they still listed four dictation languages).

Why
A tester on X: everything said in Brazilian Portuguese came out in English,
with translation off. On a pt phone Automatic found no listed language and fell
back to English (DictationLanguage.automatic(null, ["pt"]) == English, the
same path the existing "ja" assertion covers), so Whisper was told "en", and
told "en" on Portuguese speech, Whisper writes an English translation.

What Portuguese gets from the text rules (none falls back to English)
- Spoken punctuation: already had a Portuguese table (vírgula, ponto de
  interrogação, ...), mirrored from iOS.
- Cleanup, list formatting, spoken symbols and counts, hesitation trimming:
  no Portuguese rules, so each returns the text unchanged for "pt". English
  rules would have deleted "um" (a filler there, "a/one" here) and read "no"
  as a correction marker.
- Styles: spacing, sentence capitals and the closing period (Polished),
  lowercase (Casual), bullets (Notes), unchanged words (Verbatim).

Measured (native macOS CPU build of the app's whisper.cpp d1be6fd, the app's
exact parameters: greedy, translate off, no context, no timestamps,
suppress_nst, audio_ctx 512 for small on clips up to 8 s; 2 threads; 15 macOS
say clips, 10 Brazilian voices Luciana/Eddy/Flo/Reed and 5 European Joana,
3 with a music bed; no emulator)
- Whisper small told "en" (Automatic on a pt phone before this change): 13/15
  clips came out as English, e.g. "Vou chegar um pouco atrasado na reunião."
  became "I will arrive a little late at the meeting."; WER 87.3%.
- Told "pt" (Automatic after this change): WER 6.9% (7/102 words);
  Brazil 7.5%, Portugal 5.7%. European spelling kept ("Estás a ver o jogo na
  televisão?", "pequeno almoço").
- Told "es" (the nearest language a user could pick before): WER 70.6%.
- Bundled tiny (before the small download) told "pt": WER 32.4%; told "en":
  English or nonsense on every clip.

Verified
- ./gradlew --no-daemon :app:testDebugUnitTest on the Studio: InsertionTest
  40/40 (new test: Automatic and matching for "pt", Polished/Casual/Verbatim
  with cleanup, lists and spoken punctuation on, mid-sentence case),
  NeverSuggestTest 27/27.
- Not run on an emulator or phone: the Studio's emulator was in use and has no
  audio input. No new strings: language names are not translated.
2026-11-23 14:04:13 -05:00
..
src Android: dictate in Portuguese (#2562) 2026-11-23 14:04:13 -05:00
build.gradle.kts Android: Hex Preview, an APK outside Google Play that updates itself (#2531) 2026-11-23 11:37:51 -05:00
proguard-rules.pro Hex for Android: on-device dictation keyboard (#2074) 2026-11-20 17:27:17 +00:00