hex/android/benchmark/typing/critical-cases.json
Ryan Vogel 0add67e372 android typing: a reproducible Brazilian Portuguese model (pt.hextm, pt.valid, pt.capitals), not wired up yet
Google Books has no Portuguese, so the model is counted from sources licensed for commercial use
with attribution only (CC BY 4.0), each file pinned in benchmark/typing/pt-inputs.tsv by URL, fetch
date, size and SHA-256:
- 14 Leipzig Corpora Collection news downloads (only the downloads; the site and API are CC BY-NC),
  each sentence given to Brazil or Portugal by its site (.br, .pt, else spelling markers).
- ParlaIbero-BR and -PT v2 (Câmara dos Deputados 2009-2025, Assembleia da República 1995-2025).

build-layout-model.py pt: Brazil's counts (181.5M news words, 138.1M words of speech), news counted
ten times a speech for words and alone for word pairs (with speech pairs in, "obrigado" was followed
by "sr" and "deputado"), less spellings retired in 1990 ("idéia", "vôo") and plain twins 20 times
rarer than an accented one ("nao", "voce", Polish's rule), plus Hex's own chat words
(pt-extra-words.tsv, a draft for a Brazilian speaker to read). 100,029 words, 380,416 pairs, 3.60 MB.
build-valid-words.py pt: Brazil's other lowercase spellings, then Portugal's own spellings from
Portugal's counts ("telemóvel", "receção"), so a Portuguese typist's correct word stays as typed.
build-capitals.py pt: case shares from the same Brazilian counts, held as French's are.

Held-out set: portuguese_set.py makes held-out/pt.tsv.gz exactly as polish_set.py makes Polish's,
from Brazilian contributors' Tatoeba sentences; accent keys and seven critical cases added.
quality-gate.py now takes more than two critical cases (Polish already had five).
The APK pins the three new files (SHA256SUMS, verifyTypingModels); no layout or keyboard code
reads them yet, so nothing a person sees changes.

Verified: a from-scratch rebuild on the Studio in a separate folder gave byte-identical files
(pt.hextm 387bf9b6..., pt.valid b92acc12..., pt.capitals 0210f5bd...); 12,800 of the 12,873
held-out reference words are model or list words; on 5,000 other Brazilian Tatoeba sentences the
model reads 6.54 nats per known word (news only 6.55, speech only 6.90, both alike 6.59).
Not yet run: quality-gate.py pt (it compiles the app with Gradle, which waits for the coordinator).
2026-11-24 18:10:17 -05:00

10 lines
1.3 KiB
JSON

{
"en": [["correct article typo", "teh cat", "the cat"], ["keep noun well", "a deep well", "a deep well"]],
"es": [["restore después", "hasta despues", "hasta después"], ["keep article el", "el tren", "el tren"]],
"de": [["restore transposed dank", "vielen dnak", "vielen dank"], ["keep adverb schon", "schon gut", "schon gut"]],
"nb": [["restore doubled consonant", "tusen takkk", "tusen takk"], ["keep article en", "jeg har en bok", "jeg har en bok"]],
"fr": [["restore café", "le cafe", "le café"], ["keep verb a", "il a faim", "il a faim"]],
"it": [["restore caffè", "un caffe", "un caffè"], ["keep conjunction e", "pane e vino", "pane e vino"]],
"pl": [["restore żółw", "to jest zolw", "to jest żółw"], ["keep correct words", "nie mam czasu", "nie mam czasu"], ["keep a name", "bartek ma kota", "bartek ma kota"], ["restore że", "wiem ze tak", "wiem że tak"], ["keep ze, restore the rest", "ide ze szkoly", "idę ze szkoły"]],
"pt": [["restore não", "nao sei", "não sei"], ["restore você está", "voce esta bem", "você está bem"], ["restore é", "ele e muito bom", "ele é muito bom"], ["keep conjunction e", "eu e ela", "eu e ela"], ["restore atenção", "obrigado pela atencao", "obrigado pela atenção"], ["restore vê amanhã", "a gente se ve amanha", "a gente se vê amanhã"], ["keep Portugal's facto", "de facto", "de facto"]]
}