keyman icon indicating copy to clipboard operation
keyman copied to clipboard

change(common/models/templates): rework Trie predict method to utilize traversals 📚

Open jahorton opened this issue 1 year ago • 2 comments

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.

jahorton avatar Jun 25 '24 06:06 jahorton

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.
  1. Installed the "Keyman-18.0.60.apk" file and gave all permissions to the application.
  2. Checked the "Enable Keyman as system-wide keyboard" and set the keyboard as the default keyboard box on the settings page.
  3. Open the Keyman app. Enable the "Predictions" and install the "Dictionary."
  4. The banner suggested correct word lists while typing letters.
  5. the word appears in double quotes on the banner if deleting letters.
  6. the banner suggests a word while typing letters.
  7. It works well in the Android and iOS environments. Thank you.

dinakaranr avatar Jul 03 '24 12:07 dinakaranr

Changes in this pull request will be available for download in Keyman version 18.0.70-alpha

keyman-server avatar Jul 08 '24 18:07 keyman-server