TestFlight build 56 (English and Portuguese, iPhone 15 Pro Max): Apple's
keyboard puts "nao sei" right once "sei" shows it was Portuguese. Hex
already wrote "não" for "nao" beside Português (build 56 and dev, checked
on a simulator), but a word one language knows as typed stayed: "voce" is
an English word, so "voce esta" kept "voce".
Bilingual autocorrect now revises the word before when the next word
leans the other language (AutocorrectEngine.accentRevision, called from
revision(of:) after bilingualRevision): a word kept because only one
language knows it takes the other's accents ("voce esta" -> "você esta").
Only a lowercase guess of that dictionary's that adds accents alone, to a
word typed without any, and not when the words before lean the other way.
The revision is tagged with the language it is in (lastRevisionLanguage),
so Learn each language separately and the strip's revert see Portuguese.
workingPartner, knowsAsTyped, languageLean and withoutAddedCapitals lose
private so the new file (AutocorrectEngine+Accents.swift) can use them;
AutocorrectEngine.swift is 4 lines from the 1,500-line cap.
Verified:
- xcodebuild test (HEXMobile, iPhone 17 sim, iOS 27.2): 657 tests, 1
skipped, 0 failures, with a new case in AutocorrectEngineTests.
- Held-out autocorrect benchmark (2,000 sentences each, synthetic taps),
before (origin/dev 6f0b20c1) -> after: English alone 5.75% (113 broken)
-> 5.75% (113), Spanish alone 9.06% (77) -> 9.06% (77), identical
outputs; English with Português 5.86% (116) -> 5.86% (116), identical;
Spanish with Português 9.73% -> 9.56% (94 broken both; 22 sentences
better, 0 worse).
- Live on an iPhone 17 simulator (iOS 27.2), Hex keyboard with English and
Português, HID key taps: "voce esta " was "Voce esta ", now "Você esta ";
"nao sei " and "nao " stay "Não sei "/"Não "; "I ate a big lunch", "The
data is real", "I said no so we left", "Come to me now" and "Sotto voce
please" unchanged.