fix(web): support autocorrection of transposed text - #16450
Conversation
User Test ResultsTest specification and instructions Retesting TemplateTest Artifacts |
Co-authored-by: Marc Durdin <marc@durdin.net>
Test Specs
Test Results
Screen.Recording.2026-09-01.at.11.25.01.in.the.morning.mov
|
…tocorrect' into fix/web/support-transposition-autocorrect
|
OK, I've made some adjustments. Mind giving it a retry? Test-bot: retest TEST_TEH |
Test Specs
Test Results
Screen.Recording.2026-09-08.at.4.01.30.in.the.afternoon.mov |
|
I am unable to reproduce the effects you're seeing when using the downloaded artifact when emulating the test device you mentioned on my Mac. (Predictive-text won't even run properly, with errors being thrown!) Interestingly, it seems to operate fine when emulating it on Windows... and only then do I see the issue. Targeting a more up-to-date Android device seems to work much better. Could you retest against an API 32 (or more recent) Android device and see if the same issue reproduces then? |
|
That's interesting to know, Josh. I'll try it out on a new API, and a physically device, if needed. |
Test Specs
Test Results
Test Specs
Test Results
I'll try testing on Windows one more time, and then move to a physical device. Update: It's showing the same behavior and result on Windows Android Studio. |
Test Specs
The same error suggestion is also happening on a physical device: Recording_20260914_114810.mp4However, I got some errors popping up on the physical android device: Warning "Failed to retrieve downloaded file" Recording_20260914_115352.mp4 |
I suspect that this may be the user-visible symptoms of #13862 |
Investigating both error-message strings and looking through recent Sentry error reports... we have nothing matching these errors or the video displaying them in our Sentry logs. A search for reports in the
This would occur when attempting to migrate a local KMP file into the Keyman app's file-organization pattern, like when installing an ad-hoc KMP or when installing from online. Examining its locations in the code, we shouldn't see a reported error for this.
I could perhaps see this happening if the download attempt saw an internet connectivity disruption that interrupted a download partway?
This would occur when trying and failing to check for package updates or when attempting to download a keyboard.
|
|
Good investigation @jahorton, sorry for the misdirection in my guess! |
|
After further investigation and brainstorming, I realized a potential cause we've run into once before. Back when epic/gestures was wrapping up, we saw a lot of performance and keys-out-of-sequence bugs on Android devices, which were due to their generally lower performance profile. Modeling fat-fingering for transpositions incurs a noticeable "edit distance cost" that penalizes a potential search path. If performance were to be low enough that the search never actually is able to investigate the affected transposition nodes, it would appear as if transpositions aren't being handled by the engine. So... what if the issue here is actually an optimization issue? After a bit of interactive debugging, I realized that the code, as it was, could set up cases where transposition path modeling could overlap with path modeling that involves a sequence of other edit types:
I verified that such cases were happening and have added new changes (in the latest commit above) that block the transpose-and-replace path from adding redundant search paths. The fewer low-cost, redundant / dead paths there are to search, the easier it will be for correction-search to fully evaluate proper transposition-modeling paths. |
|
Oh, and... Test-bot: retest TEST_TEH 🤞 |
…ccidentally ignored
Test Specs
Test Results
|
|
Changes in this pull request will be available for download in Keyman version 19.0.287-alpha |
Fixes: keymanapp#16577 From 14.0 up until now, our correction-search focused on the minimum "correction distance" to a possible text _correction_, then performed prediction _on top of that_. This PR changes the search to integrate word-frequency weighting from models within the search, allowing us to optimize for the most likely predictions. There is no additional performace cost impact of note here - the probability associated with a correction's best prediction is already accessible O(1) with operations we've already been doing. It is likely that this will help further mitigate issues with transposition handling noted in the user tests for keymanapp#16450. Build-bot: skip release:web,android,ios
Fixes: #16398
Fixes: #16399
Fixes: #12311
Note: will not handle transpositions that cross token boundaries.
Also note: major changes will be needed for epic/boundary-correction, as it will discontinue use of the LegacyQuotientSpur type.
Build-bot: skip release:web,android,ios
User Testing
TEST_TEH: Using Keyman for Android, type
tehand verify thattheshows up as a suggestion and is autoselected.TEST_TEHRE: Using Keyman for Android, type
tehreand verify thatthereshows up as a suggestion and is autoselected.TEST_FREI: Using Keyman for Android, type
freiand verify thatfriendshows up as a suggestion. (Autoselection is not expected here.)