hex/android/benchmark/typing/GateLexicon.java
Ryan Vogel afdd8e98a4 Gate only unambiguous restorations of hold-only letters
Replace the all-accent score with mappings verified against the Android key rows and long-press menus. Use model and validity spellings to report ambiguous restoration and clean-word harm separately, so literal dedicated keys and legitimate competing spellings cannot fail the 85% gate. Add attributed German and Bokmål evaluation sentences and report frequent Bokmål clean changes.

Verified all six gates on the Studio in 26.5s: English, Spanish and French pass; German, Italian and Bokmål fail. Each of the 18 raw, decoded and clean-change counts matched the preceding commit. All 12 layout-appropriate critical cases passed, French alone returned 0, the full run returned 1, and code-shape passed.
2026-11-22 09:12:01 -05:00

26 lines
1.1 KiB
Java

package local.hex.bench;
import java.io.File;
import java.util.*;
import ly.anoma.hex.keyboard.KeyboardLetters;
import ly.anoma.hex.keyboard.LetterFeedback;
import ly.anoma.hex.typing.TypingModel;
/** Export the production model vocabulary and its hold-only letters on the actual layout. */
public final class GateLexicon {
public static void main(String[] args) throws Exception {
String lang = args[1];
TypingModel model = TypingModel.Companion.file(new File(args[0]), lang);
String keys = String.join("", KeyboardLetters.INSTANCE.rows(lang));
List<String> holds = new ArrayList<>();
for (char key : keys.toCharArray()) {
for (String option : LetterFeedback.Companion.options(key, lang)) {
char c = option.charAt(0);
if (Character.isLetter(c) && keys.indexOf(c) == -1 && model.code(c) != 0)
holds.add(option + ":" + key);
}
}
System.out.println(String.join(" ", holds));
for (int i = 0; i < model.getWords(); i++) System.out.println(model.text(i));
}
}