mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
Ports three TypingDecoder changes iOS made after Android was aligned on Nov 20 (#2125 and the space-tap reading), so the same taps give the same readings: - Dropping a tap now costs more when it was clearly aimed at a key of its own (7 + up to 4 nats by its margin over the next key); a repeat or a touch between keys keeps the flat 7. Replaces Android's flat 7 for every dropped tap, which let a common pair erase a letter ("I promised tom" -> "to"). - An accented letter is also read from its base letter's key at +1 even when it has a key of its own (ä from a on QWERTZ, ñ from n). Replaces the old rule, which only filled letters without a key, so "madchen" could never be "mädchen" and "manana" never "mañana". - A tap on the bottom letter row's upper half, above the space bar, can be a missed space, read only as the letters typed on each side ("ofbthe" -> "of the"), priced by how much nearer the row than the bar it landed. Off for Spanish, as on iOS. KeyGrid takes the space bar's keycap (KeyRect); it is optional, so the IME keeps its current behaviour until the keyboard passes it. Benchmark: the replay now also runs German and Bokmål sets (synthetic_de_nb.py, held-out Tatoeba sentences with the same touch model on Android's eleven-key rows) and writes each sentence's output. Verified on the Studio (API 35 emulator, installed debug APK, 2,000 held-out sentences each), word errors before -> after: - English 1,028 (7.41%) -> 913 (6.58%); today's iOS 798 (5.75%) - Spanish 1,374 (10.33%) -> 1,373 (10.32%); today's iOS 1,205 (9.06%) - German 825 (6.09%) -> 812 (5.99%) - Bokmål 692 (5.54%) -> 678 (5.43%) testDebugUnitTest: 16 tests, 0 failures, with three iOS AutocorrectEngineTests cases re-expressed (the aimed tap, the bottom-row space, accents from the base key).
25 lines
1.5 KiB
Shell
Executable file
25 lines
1.5 KiB
Shell
Executable file
#!/bin/sh
|
|
# Run in the Android project on the Studio. The debug APK is already installed.
|
|
set -eu
|
|
: "${ANDROID_HOME:?}" "${JAVA_HOME:?}" "${T:?Studio phase scratch}" "${ANDROID_SERIAL:?}"
|
|
cd "$(dirname "$0")/../.."
|
|
lib="$ANDROID_HOME/platforms/android-35/android.jar"
|
|
bt="$ANDROID_HOME/build-tools/35.0.0"
|
|
work="$T/replay"; dev=/data/local/tmp/hex4
|
|
mkdir -p "$work/classes"; adb shell mkdir -p "$dev"
|
|
"$JAVA_HOME/bin/javac" --release 8 -cp "$lib:app/build/tmp/kotlin-classes/debug" -d "$work/classes" benchmark/typing/Replay.java
|
|
"$JAVA_HOME/bin/jar" cf "$work/replay-classes.jar" -C "$work/classes" .
|
|
"$bt/d8" --min-api 31 --lib "$lib" --output "$work/replay-dex.jar" "$work/replay-classes.jar"
|
|
adb push "$work/replay-dex.jar" "$dev/replay.jar" >/dev/null
|
|
adb shell chmod 444 "$dev/replay.jar"
|
|
apk=$(adb shell pm path ly.anoma.hex | tr -d '\r' | sed 's/^package://')
|
|
adb push app/src/main/assets/typing/en.valid "$dev/en.valid" >/dev/null
|
|
adb push app/src/main/assets/typing/never-suggest.tsv "$dev/never-suggest.tsv" >/dev/null
|
|
mkdir -p "$T/outputs"
|
|
for lang in en es de nb; do
|
|
[ -f "$T/bench/$lang.jsonl" ] || continue
|
|
adb push "app/src/main/assets/typing/$lang.hextm" "$dev/$lang.hextm" >/dev/null
|
|
adb push "$T/bench/$lang.jsonl" "$dev/$lang.jsonl" >/dev/null
|
|
adb shell "CLASSPATH=$dev/replay.jar:$apk app_process /system/bin local.hex.bench.Replay $dev/$lang.hextm $dev/$lang.jsonl $lang $dev/$lang.out"
|
|
adb pull "$dev/$lang.out" "$T/outputs/$lang.tsv" >/dev/null
|
|
done
|