change(common/models/templates): rework Trie predict method to utilize traversals 📚
This PR follows from #11868 and #11869. While not originally part of #10973, it certainly leverages the same set of changes and will make a great base for future work toward user-dictionary support. (I did originally piece this together at the same time, though - just as a 'sibling' branch instead of as a descendant.)
Rather than keep two separate sets of logic for navigating through the Trie's nodes, this set of changes removes the old pattern, allowing prediction-lookup based on a prefix to operate via the properties defined on the LexiconTraversal structure. This essentially "dog-foods" the new pattern while keeping to DRY principles.
As mentioned in the description of #11868, this also aims to support merging / blending two (or more) different models together via their LexiconTraversal iterators in order to facilitate #11872. We'd want to blend the models together, then predict based on that blend.
To be clear, we already have these related items on our roadmap, in one sense or another:
- user dictionaries (feeding device-provided personal data into a predictions for a user)
- learning (so, learning the user's commonly-typed words and using them for corrections and predictions)
Both would likely be their own model that could be blended together in the manner described above.
User Testing
TEST_PREDICTIVE_TEXT: Using Keyman for Android or for iOS, verify that predictive text operates normally.
User Test Results
Test specification and instructions
- ✅ TEST_PREDICTIVE_TEXT (PASSED): I tested this issue with the attached "Keyman-18.0.60-alpha-test-11870" build on the Android 14 Physical device and iOS(18.0.60-0.11870.11393). Here is my observation. (notes)
Test Artifacts
- Android
- Developer
- iOS
- Keyboards
- Web
- Windows
Test Results
- TEST_PREDICTIVE_TEXT (Passed): I tested this issue with the attached "Keyman-18.0.60-alpha-test-11870" build on the Android 14 Physical device and iOS(18.0.60-0.11870.11393). Here is my observation.
- Installed the "Keyman-18.0.60.apk" file and gave all permissions to the application.
- Checked the "Enable Keyman as system-wide keyboard" and set the keyboard as the default keyboard box on the settings page.
- Open the Keyman app. Enable the "Predictions" and install the "Dictionary."
- The banner suggested correct word lists while typing letters.
- the word appears in double quotes on the banner if deleting letters.
- the banner suggests a word while typing letters.
- It works well in the Android and iOS environments. Thank you.
Changes in this pull request will be available for download in Keyman version 18.0.70-alpha