From d7f2e254ff020630f8d33e341b69cf97bf9ac6ce Mon Sep 17 00:00:00 2001 From: Dax Raad Date: Sat, 21 Nov 2026 09:35:16 -0500 Subject: [PATCH] ios: report the keyboard language to the host and restore italian accents --- docs/features/README.md | 9 ++ .../AutocorrectEngineTests.swift | 48 ++++++++++ .../FullKeyboardEngineTests.swift | 36 ++++++++ ios/HEXMobileTests/KeyboardLayoutTests.swift | 16 ++++ .../FullKeyboard/AutocorrectEngine.swift | 44 ++++++++-- .../FullKeyboard/FullKeyboardView.swift | 19 +++- .../FullKeyboard/KeyboardLanguage.swift | 87 +++++++++++++++---- ios/README.md | 32 +++++-- 8 files changed, 258 insertions(+), 33 deletions(-) diff --git a/docs/features/README.md b/docs/features/README.md index 7aa6ea5b4..742b194fa 100644 --- a/docs/features/README.md +++ b/docs/features/README.md @@ -2866,6 +2866,15 @@ Windows `hex app` -> one tray process, Rune window // dev.rune-ui-windows iOS prototype (`HEXMobile`) -> Record/transcribe/copy and keyboard handoff ├── Experiments: Full keyboard, Apple Intelligence cleanup, Custom vocabulary, │ Hinglish, Adaptive touch, German spatial autocorrect, Learn each language separately +├── Full keyboard's languages (Settings › Keyboard › Languages, with Full chosen): one or +│ more layouts, the space bar names the current one and a slide switches letters, accents +│ and autocorrect, and the input mode reports the language typing +│ (`UIInputViewController.primaryLanguage`, which Apple documents as superseding the +│ Info.plist's en-US; unit-tested, whether the host's spelling follows it is unverified on +│ a device); Italian restores unambiguous unaccented spellings on space ("perche" → +│ "perché", "citta" → "città", `KeyboardLanguage.accentRestorations`) and offers "è" and +│ "c'è" in the strip for "e" and "ce", which are words of their own and are never changed +│ by space ├── German spatial autocorrect (off by default, `experiments.germanSpatialAutocorrect`): │ with Spatial autocorrect on too, the Deutsch layout reads taps with the German │ model Android ships (`ios/HEXKeyboard/TypingModel/de.hextm`, the same v3 file diff --git a/ios/HEXMobileTests/AutocorrectEngineTests.swift b/ios/HEXMobileTests/AutocorrectEngineTests.swift index dd1aa3581..622390428 100644 --- a/ios/HEXMobileTests/AutocorrectEngineTests.swift +++ b/ios/HEXMobileTests/AutocorrectEngineTests.swift @@ -413,6 +413,54 @@ final class AutocorrectEngineTests: XCTestCase { XCTAssertEqual(target.text, "Domani andiamo al mare con i bambini perché Sono molto stai ") } + /// Italian's unaccented spellings only come from its own table, and only where the plain + /// spelling is no word: "e" is "and" and "ce" is "to us", so they stay as typed and the + /// strip offers "è" and "c'è", which space never applies. + func testItalianRestoresUnambiguousAccentsAndSuggestsTheAmbiguousOnes() { + let italian = stubbed { + $0.valid = ["e", "ce", "perche", "citta"] + } + italian.setLanguage(.italian, available: ["it"]) + XCTAssertEqual(fix(italian, "perche"), "perché", "even a checker that calls it valid") + XCTAssertEqual(fix(italian, "citta"), "città") + XCTAssertEqual(fix(italian, "piu"), "più") + XCTAssertEqual(fix(italian, "Citta"), "Città") + XCTAssertNil(fix(italian, "e"), "\"e\" is and") + XCTAssertNil(fix(italian, "ce"), "\"ce\" is to us") + let e = italian.suggestions(beforeInput: "e", field: .text, autocorrectionType: .default) + XCTAssertEqual(e.dropFirst().first?.replacement, "è") + XCTAssertFalse(e.dropFirst().first?.willAutoReplace ?? true, "space never applies it") + let ce = italian.suggestions(beforeInput: "ce", field: .text, autocorrectionType: .default) + XCTAssertEqual(ce.dropFirst().first?.replacement, "c'è") + XCTAssertFalse(ce.dropFirst().first?.willAutoReplace ?? true, "space never applies it") + + // Bilingual autocorrect: the table is this language's own spelling even when the + // partner's dictionary takes the plain form for a word (English beside Italian). + let english = StubChecker() + english.valid = ["perche", "the"] + italian.setPartner(.english, available: ["it", "en_US"], checker: english) + XCTAssertEqual(italian.partner?.language, .english) + XCTAssertEqual(fix(italian, "perche"), "perché", "the table wins beside English") + XCTAssertNil(fix(italian, "the"), "an English word stays") + + // It decides before the bilingual lean too, not only when the partner knows the plain + // spelling: English words before "piu" would otherwise hand it to the partner's guess. + english.valid.insert("pi") + english.guessTable["piu"] = ["pi"] + XCTAssertEqual(fix(italian, before: "the meeting piu"), "più") + } + + /// Every restoration only adds accents: it never changes a letter ("perche" -> "perché"). + func testItalianAccentRestorationsOnlyAddAccents() { + for (plain, accented) in KeyboardLanguage.italian.accentRestorations { + XCTAssertEqual( + accented.folding(options: .diacriticInsensitive, locale: nil), + plain, + plain + ) + } + } + /// Russian types in Russian: its words stay and its typos get Russian fixes, never English. func testRussianCorrectsInRussianNeverEnglish() { engine.language = .russian diff --git a/ios/HEXMobileTests/FullKeyboardEngineTests.swift b/ios/HEXMobileTests/FullKeyboardEngineTests.swift index d58d9b23c..70e2c52ce 100644 --- a/ios/HEXMobileTests/FullKeyboardEngineTests.swift +++ b/ios/HEXMobileTests/FullKeyboardEngineTests.swift @@ -2228,6 +2228,26 @@ final class FullKeyboardEngineTests: XCTestCase { XCTAssertEqual(view.plane.swipe?.model.language, "es") } + /// The input mode's language (`UIInputViewController.primaryLanguage`), which Apple + /// documents as superseding the Info.plist's en-US: the keyboard reports the language + /// resolved before the controller attaches, and each space-bar switch. + func testTheInputModeLanguageFollowsTheSpaceBar() { + let settings = LanguageSettings(defaults: defaults) + settings.keyboardLanguages = [.italian, .english] + let view = FullKeyboardView(model: KeyboardViewModel(), target: target) + view.languageSettings = settings + XCTAssertEqual(view.reportedInputModeLanguage, "it-IT") + + let controller = RecordingInputController() + view.hostController = controller + XCTAssertEqual(controller.primaryLanguage, "it-IT", "reported when the controller attaches") + view.switchLanguage(by: 1) + XCTAssertEqual(controller.primaryLanguage, "en-US") + view.switchLanguage(by: 1) + XCTAssertEqual(controller.primaryLanguage, "it-IT") + XCTAssertEqual(controller.reportedLanguages, ["it-IT", "en-US", "it-IT"], "each change sent once") + } + func testOnlyTheEnglishAndSpanishLayoutsSwipe() { let view = FullKeyboardView(model: KeyboardViewModel(), target: FixtureTextTarget()) view.swipeOverride = true @@ -2758,3 +2778,19 @@ extension FullKeyboardEngineTests { XCTAssertEqual(AdaptiveTouchStatus.current(settings: settings, fullAccessConfirmed: true), .learning(taps: 400)) } } + +/// Records each language the keyboard reports as its input mode's (`primaryLanguage`), so the +/// test sees both the value and how often it was sent. +@MainActor +private final class RecordingInputController: UIInputViewController { + private(set) var reportedLanguages: [String] = [] + + override var primaryLanguage: String? { + get { reportedLanguages.last } + set { + if let newValue { + reportedLanguages.append(newValue) + } + } + } +} diff --git a/ios/HEXMobileTests/KeyboardLayoutTests.swift b/ios/HEXMobileTests/KeyboardLayoutTests.swift index 0ff3b1f4f..53a2a3abe 100644 --- a/ios/HEXMobileTests/KeyboardLayoutTests.swift +++ b/ios/HEXMobileTests/KeyboardLayoutTests.swift @@ -1444,6 +1444,22 @@ final class KeyboardLayoutTests: XCTestCase { XCTAssertNil(KeyboardLanguage.serbianLatin.spellCheckLanguage(available: ["en_US", "sr", "hr_HR"]), "no Cyrillic or Croatian") } + /// The input mode's language (`UIInputViewController.primaryLanguage`) is BCP 47 and + /// supersedes the Info.plist's en-US, so each layout names the language the host's + /// spelling and autocorrection follow. + func testEachLanguageNamesItsInputMode() { + XCTAssertEqual(KeyboardLanguage.english.inputModeLanguage, "en-US") + XCTAssertEqual(KeyboardLanguage.italian.inputModeLanguage, "it-IT") + XCTAssertEqual(KeyboardLanguage.spanish.inputModeLanguage, "es-ES") + XCTAssertEqual(KeyboardLanguage.frenchCanadian.inputModeLanguage, "fr-CA") + XCTAssertEqual(KeyboardLanguage.serbianLatin.inputModeLanguage, "sr-Latn-RS") + XCTAssertEqual( + Set(KeyboardLanguage.allCases.map(\.inputModeLanguage)).count, + KeyboardLanguage.allCases.count, + "one identifier each" + ) + } + // MARK: - Helpers private func landscapeLayouts() -> [KeyboardLayout] { diff --git a/ios/HEXShared/FullKeyboard/AutocorrectEngine.swift b/ios/HEXShared/FullKeyboard/AutocorrectEngine.swift index 0f141c69d..9d5e44894 100644 --- a/ios/HEXShared/FullKeyboard/AutocorrectEngine.swift +++ b/ios/HEXShared/FullKeyboard/AutocorrectEngine.swift @@ -724,6 +724,11 @@ final class AutocorrectEngine { pool.append(cased(learned, typed: token)) } else if language.usesEnglishFixes, let suggested = Self.suggestOnlyContractions[lower] { pool.append(Self.matchCase(of: token, onto: suggested)) + } else if !suppressedInSession.contains(lower), !learning.rejected.contains(lower), + !learnedWords.contains(lower), let accented = language.accentSuggestions[lower] { + // Offered, never put in by space: the plain spelling is a word of its own + // ("e" is "and", "ce" is "to us"), as the contractions above are. + pool.append(cased(accented, typed: token)) } } @@ -833,14 +838,21 @@ final class AutocorrectEngine { /// keys, else the keyboard's own language's. Held-out English benchmark, French beside it: /// 7.56% WER before, 5.79% now, against 5.75% alone. private func cautiousReplacement(for token: String) -> String? { - guard let partner = workingPartner else { - lastFixLanguage = language - return ownReplacement(for: token) - } if let shortcut = shortcut(for: token) { lastFixLanguage = nil return shortcut } + // This language's own accented spelling decides before any partner logic: the table + // only holds plain spellings that are no word of this language ("perche" -> "perché"), + // so an English lean must not hand it to the other dictionary's guess. + if let accented = accentRestoration(for: token) { + lastFixLanguage = language + return accented + } + guard let partner = workingPartner else { + lastFixLanguage = language + return ownReplacement(for: token) + } let lean = languageLean(partner, token: token) // One-letter words are left to the keyboard's own language: `UITextChecker` takes // every letter as a word, so English "i" would never become "I" beside French. @@ -1065,7 +1077,15 @@ final class AutocorrectEngine { return Self.matchCase(of: token, onto: fix) } - // 4. Single-edit `UITextChecker` typo on words of 3+ characters, never rewriting valid words. + // 4. A word typed without its accent where the plain spelling is no word of the + // language ("perche" -> "perché", "citta" -> "città"): the dictionary path below + // needs three letters and never rewrites a word it knows, and a language's own list + // is deterministic. Ambiguous pairs ("e"/"è", "ce"/"c'è") are suggestion-only. + if let accented = accentRestoration(for: token) { + return accented + } + + // 5. Single-edit `UITextChecker` typo on words of 3+ characters, never rewriting valid words. guard token.count >= 3, !token.contains("'") else { return nil } guard !checker.isWordValid(token) else { return nil } @@ -1086,6 +1106,20 @@ final class AutocorrectEngine { return withoutAddedCapitals(cased(bestGuess, typed: token), typed: token) } + /// The language's own accented spelling of `token`, where the plain spelling is no word + /// of it ("perche" -> "perché"), or nil. All-caps and mixed-case words are left alone, + /// as the dictionary path leaves them, and the table only holds non-words of this + /// language, so it may decide before a bilingual partner's dictionary does. + private func accentRestoration(for token: String) -> String? { + let isAllCaps = token.count >= 2 && token == token.uppercased() && token != token.lowercased() + guard !isAllCaps, !token.dropFirst().contains(where: \.isUppercase) else { return nil } + let lower = token.lowercased() + guard let accented = language.accentRestorations[lower], mayOffer(accented, replacing: token) else { + return nil + } + return withoutAddedCapitals(cased(accented, typed: token), typed: token) + } + /// `candidate` cased as `token` was typed (`matchCase`), less a capital it only has /// from where it was learned (`withoutStrayCapital`). private func cased(_ candidate: String, typed token: String) -> String { diff --git a/ios/HEXShared/FullKeyboard/FullKeyboardView.swift b/ios/HEXShared/FullKeyboard/FullKeyboardView.swift index 8e11f5163..f476ce73a 100644 --- a/ios/HEXShared/FullKeyboard/FullKeyboardView.swift +++ b/ios/HEXShared/FullKeyboard/FullKeyboardView.swift @@ -9,7 +9,14 @@ final class FullKeyboardView: UIView { let model: KeyboardViewModel let engine: FullKeyboardEngine weak var hostController: UIInputViewController? { - didSet { configureGlobe() } + didSet { + configureGlobe() + // `init` resolves the language before the controller attaches (it is the caller's + // to set), so report what is already known, not only later changes. + if let reportedInputModeLanguage { + hostController?.primaryLanguage = reportedInputModeLanguage + } + } } /// Fixtures force light or dark and portrait or landscape; the keyboard follows its field. @@ -348,6 +355,9 @@ final class FullKeyboardView: UIView { /// The languages the space bar switches between and the one typing now. private(set) var languages = KeyboardLanguageList(languages: [.english], current: .english) + /// The input mode's language last reported to the host (`UIInputViewController.primaryLanguage`), + /// so the host's spelling and autocorrection follow the language typing. + private(set) var reportedInputModeLanguage: String? /// The language this keyboard last switched to, ahead of the App Group's copy, which an /// iPhone may not let a keyboard without Full Access write. private var switchedLanguage: KeyboardLanguage? @@ -380,6 +390,13 @@ final class FullKeyboardView: UIView { } // The keys' language's layout: with English and Spanish on one keyboard, the first one's. let letters = letterLayoutOverride.map(list.layout.offered) ?? settings.letterLayout(for: list.layout) + // The host spells and autocorrects in the input mode's language, which supersedes the + // Info.plist's en-US (`primaryLanguage`): report every change, a space-bar switch too. + let identifier = list.current.inputModeLanguage + if identifier != reportedInputModeLanguage { + reportedInputModeLanguage = identifier + hostController?.primaryLanguage = identifier + } guard list != languages || engine.language != list.current || engine.letterLayout != letters else { return } languages = list engine.switchesLanguage = list.switches diff --git a/ios/HEXShared/FullKeyboard/KeyboardLanguage.swift b/ios/HEXShared/FullKeyboard/KeyboardLanguage.swift index 705ab2e78..adf42fb61 100644 --- a/ios/HEXShared/FullKeyboard/KeyboardLanguage.swift +++ b/ios/HEXShared/FullKeyboard/KeyboardLanguage.swift @@ -69,6 +69,30 @@ nonisolated enum KeyboardLanguage: String, CaseIterable, Sendable { String(rawValue.prefix { $0 != "-" }) } + /// The BCP 47 identifier the keyboard reports as its input mode's language + /// (`UIInputViewController.primaryLanguage`, which supersedes the Info.plist's + /// `PrimaryLanguage`), so the host's spelling and autocorrection follow the language + /// typing: the language's usual region, as `dictationLanguage` falls back to. + var inputModeLanguage: String { + switch self { + case .english: "en-US" + case .norwegian: "nb-NO" + case .spanish: "es-ES" + case .german: "de-DE" + case .italian: "it-IT" + case .french: "fr-FR" + case .frenchCanadian: "fr-CA" + case .frenchSwiss: "fr-CH" + case .portuguese: "pt-BR" + case .polish: "pl-PL" + case .romanian: "ro-RO" + case .russian: "ru-RU" + case .ukrainian: "uk-UA" + case .greek: "el-GR" + case .serbianLatin: "sr-Latn-RS" + } + } + /// Latin letters, so another Latin-script language can be autocorrected on its keys /// (bilingual autocorrect). Russian's and Ukrainian's are Cyrillic, Greek's Greek. var isLatin: Bool { self != .russian && self != .ukrainian && self != .greek } @@ -90,23 +114,7 @@ nonisolated enum KeyboardLanguage: String, CaseIterable, Sendable { func key(_ identifier: String) -> String { identifier.replacingOccurrences(of: "_", with: "-").lowercased() } - let usual = switch self { - case .english: "en-US" - case .norwegian: "nb-NO" - case .spanish: "es-ES" - case .german: "de-DE" - case .italian: "it-IT" - case .french: "fr-FR" - case .frenchCanadian: "fr-CA" - case .frenchSwiss: "fr-CH" - case .portuguese: "pt-BR" - case .polish: "pl-PL" - case .romanian: "ro-RO" - case .russian: "ru-RU" - case .ukrainian: "uk-UA" - case .greek: "el-GR" - case .serbianLatin: "sr-Latn-RS" - } + let usual = inputModeLanguage // Spanish's regions are Apple's three variants, not the iPhone's own identifier. if self == .spanish { let named = preferred.first { @@ -575,6 +583,47 @@ nonisolated enum KeyboardLanguage: String, CaseIterable, Sendable { } } + /// Unaccented spellings space puts the accent back on, where the plain spelling is no + /// word of the language at all. The dictionary path needs three letters and never + /// rewrites a word it knows, so these cannot come from it ("perche" is also the plural of + /// a fish, but that is not a common word; "cosi" is the plural of "coso" and stays out). + /// A pair whose plain spelling is a common word of its own is never here: "e" is "and", + /// "ce" is "to us", "si" is "oneself", "ne" is "of it", "da" is "from", "la" is "the" and + /// "li" is "them"; `accentSuggestions` offers those in the strip instead, as Spanish's + /// "si"/"sí" and "tu"/"tú" are left alone, and English's `suggestOnlyContractions`. + var accentRestorations: [String: String] { + switch self { + case .italian: + [ + "perche": "perché", "poiche": "poiché", "affinche": "affinché", + "benche": "benché", "finche": "finché", + "piu": "più", "gia": "già", "puo": "può", "cioe": "cioè", "percio": "perciò", + "citta": "città", "societa": "società", "universita": "università", + "qualita": "qualità", "liberta": "libertà", "verita": "verità", + "realta": "realtà", "attivita": "attività", "possibilita": "possibilità", + "difficolta": "difficoltà", "opportunita": "opportunità", + "caffe": "caffè", "giu": "giù", + "lunedi": "lunedì", "martedi": "martedì", "mercoledi": "mercoledì", + "giovedi": "giovedì", "venerdi": "venerdì", + ] + case .english, .norwegian, .spanish, .german, .french, .frenchCanadian, .frenchSwiss, + .portuguese, .polish, .romanian, .russian, .ukrainian, .greek, .serbianLatin: + [:] + } + } + + /// Accented forms whose plain spelling is a common word of its own, offered in the + /// suggestion strip and never put in by space ("e" is "and", "ce" is "to us"; "c'è" + /// uses the same straight apostrophe as the English contractions). + var accentSuggestions: [String: String] { + switch self { + case .italian: ["e": "è", "ce": "c'è"] + case .english, .norwegian, .spanish, .german, .french, .frenchCanadian, .frenchSwiss, + .portuguese, .polish, .romanian, .russian, .ukrainian, .greek, .serbianLatin: + [:] + } + } + /// Each letter's (row, column) for autocorrect's neighbouring-key cost on `letters`, with /// rows shifted as the keys are. func keyCoordinates(_ letters: KeyboardLetterLayout? = nil) -> [Character: (Double, Double)] { @@ -640,7 +689,9 @@ nonisolated enum KeyboardLanguage: String, CaseIterable, Sendable { /// Automatic follows the dictation language: its layout, or English for a language /// without one (Hebrew). Before any dictation language is known, the first /// iPhone keyboard, then preferred language, that has a layout. Hex's own input mode - /// says nothing here: its `primaryLanguage` is the Info.plist's en-US, whatever you type. + /// says nothing here: the keyboard reports the language typing there + /// (`FullKeyboardView.syncLanguage`), so following it would only repeat the choice + /// already made. static func automatic( dictationLanguage: String?, inputModes: [String], diff --git a/ios/README.md b/ios/README.md index 5eeba017e..e40a9eac1 100644 --- a/ios/README.md +++ b/ios/README.md @@ -788,11 +788,19 @@ never at a launch by itself. The globe key is unchanged. The keyboard comes back in the language it was left in, in every app and field, as Apple's keyboards do (black box: a switch in Messages held in Safari and back; `settings.keyboardLanguages.current`; without Full Access an iPhone may - keep it only while the keyboard runs). A field gives a third-party keyboard nothing to go - on: `documentInputMode` is nil in Messages and Hex's own en-US in a field that asks for - English. **Dictation follows the keyboard:** with two or more languages and Dictation - language on Automatic, dictation is in the language the space bar shows, in the iPhone's - region where Apple Speech has it (`LanguageSettings.keyboardDictationLanguage`, + keep it only while the keyboard runs). The input mode says what it types: Hex sets + `UIInputViewController.primaryLanguage` to the language's BCP 47 identifier + (`KeyboardLanguage.inputModeLanguage`) as the language changes (unit-tested), meant to + make the host spell and autocorrect in the language typing; Apple documents it as + superseding the extension's Info.plist en-US, but whether the host follows it (Notes's red + underlines, for one) is not verified on a device. Switching from the full keyboard to the + dictation bar leaves the last reported language in place. A field gives a third-party + keyboard nothing else to go on: before this change `documentInputMode` was observed as nil + in Messages and the plist's en-US in a field that asks for English; what it reports with + the runtime language is unverified. **Dictation follows the keyboard:** with + two or more languages and Dictation language on Automatic, dictation is in the language + the space bar shows, in the iPhone's region where Apple Speech has it + (`LanguageSettings.keyboardDictationLanguage`, `KeyboardLanguage.dictationLanguage`; none for Srpski), in the keyboard and in Hex, which prepares the new language between dictations (TestFlight build 56: with the keyboard on Español, dictation stayed English and Spanish came out "incomprehensible"). @@ -917,8 +925,8 @@ never at a launch by itself. Automatic follows the dictation language (Hebrew, Cyrillic Serbian and other languages without a layout get English; Serbian only in Latin script, `sr-Latn`); before any dictation language is known, the first iPhone - keyboard, then preferred language, that has a layout. It never follows Hex's own - input mode, whose `primaryLanguage` is always the Info.plist's en-US. Rows of 11 keys narrow + keyboard, then preferred language, that has a layout. It doesn't read back the input mode + Hex reports (`primaryLanguage`), which is derived from this choice. Rows of 11 keys narrow only the letters: shift, delete and the bottom row keep their English sizes, and row 3's letters sit centred between shift and delete. Russian's nine-letter row 3 wouldn't fit beside them, so there shift and delete narrow instead, as on Apple's; @@ -939,8 +947,14 @@ never at a launch by itself. and typo list (`i` → `I`) apply only to English. Neighbouring-key costs follow the layout (on QWERTZ, Z sits beside T), and an accent or tilde you left out is the cheapest fix of all ("aqui" → "aquí", "manana" → "mañana"; a word the - dictionary knows, such as "esta", is never changed); in Polish every missing - diacritic in a word counts as one such fix ("zolw" → "żółw", "maly" → "mały"). The + dictionary knows, such as "esta", is never changed). Italian also restores common + accented spellings independently of the checker's guesses and a bilingual partner's + dictionary, where the plain spelling is no word of its own ("perche" → "perché", "citta" → + "città", the days, the -ità words; `KeyboardLanguage.accentRestorations`); "e"/"è" and + "ce"/"c'è" stay as typed, because "e" is "and" and "ce" is "to us": the strip offers "è" + and "c'è", and space never applies them (`KeyboardLanguage.accentSuggestions`). In Polish + every missing diacritic in a word counts as one such fix + ("zolw" → "żółw", "maly" → "mały"). The iOS 27.2 simulator lists `pl_PL` but its checker flags no word, so Polish fixes are checked against a stub dictionary there. Greek likewise: every tonos or diaeresis left out counts as one such fix, and so does σ where the word ends in ς ("καλημερα" → "καλημέρα",