Skip to content

change(web): rework traversalless prediction, add mild whitespace-correction 🚂 🔪#15920

Merged
jahorton merged 5 commits into
epic/boundary-correctionfrom
change/web/rework-traversalless-prediction
Jun 22, 2026
Merged

change(web): rework traversalless prediction, add mild whitespace-correction 🚂 🔪#15920
jahorton merged 5 commits into
epic/boundary-correctionfrom
change/web/rework-traversalless-prediction

Conversation

@jahorton

@jahorton jahorton commented May 6, 2026

Copy link
Copy Markdown
Contributor

In this PR, the generalization work from #15919 and #16028 pay off, allowing custom and legacy models to leverage the vast majority of code that was already handling our first-class models, such as those based on the TrieModel wordlist pattern.

Build-bot: skip build:web
Test-bot: skip

@keymanapp-test-bot

keymanapp-test-bot Bot commented May 6, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

  • Web
    • KeymanWeb Test Home - build : all tests passed (no artifacts on BuildLevel "build")

@keymanapp-test-bot keymanapp-test-bot Bot changed the title change(web): rework traversalless prediction, add mild whitespace-correction change(web): rework traversalless prediction, add mild whitespace-correction 🚂 May 6, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S28 milestone May 6, 2026
@github-actions github-actions Bot added web/ web/predictive-text/ change Minor change in functionality, but not new labels May 6, 2026
@jahorton jahorton force-pushed the change/web/abstract-whitespace-tokenization-mapping branch from 7539b3e to 6c1170d Compare May 7, 2026 18:22
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from f8a1e49 to daea6e5 Compare May 7, 2026 18:22
@keyman-server keyman-server modified the milestones: A19S28, A19S29 May 11, 2026
// ContextTokenization pattern due to the model's lack of LexiconTraversal
// support, though.

const tokenizedCorrection = mapWhitespacedTokenization(tokenization.left.map((t) => { return {exampleInput: t.text} }), lexicalModel, correction.sample).tokenizedTransform;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-note: crossreference with changes in #15851 - there's a lot of overlap here. Might be best to DRY it out, especially since we may not actually want to stick with the "empty context" solution.

@jahorton jahorton force-pushed the change/web/abstract-whitespace-tokenization-mapping branch from da7359e to a800a12 Compare May 15, 2026 18:30
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from dacfc13 to 8227b81 Compare May 15, 2026 18:34
});

const predictions = predictFromCorrections(model, correctionDistribution, context);
const predictions = correctAndEnumerateWithoutTraversals(model, correctionDistribution, context);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: heavy cleanup needed here - we probably need tests for both predictFromCorrections AND for correctAndEnumerateWithoutTraversals.

const predictions: CorrectionPredictionTuple[] = tailPredictions.map((p) => {
// Concat corrections + predictions for their components.
const predictionSequence = [...predictionPrefixSequence, p];
const fullPrediction: ProbabilityMass<Suggestion> = predictionSequence.reduce((prev, curr) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #15907 - this is somewhat similar to the compositeIntermediatePredictions function defined therein. May be worth hoisting, then polishing up later in the PR chain?

@jahorton jahorton force-pushed the change/web/abstract-whitespace-tokenization-mapping branch from a800a12 to c12cef9 Compare May 18, 2026 18:24
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from f377066 to 95f3df3 Compare May 18, 2026 19:13
@jahorton jahorton force-pushed the change/web/abstract-whitespace-tokenization-mapping branch from c12cef9 to 5f4d1ee Compare May 19, 2026 18:12
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from 95f3df3 to ae6030c Compare May 21, 2026 20:25
@jahorton jahorton force-pushed the change/web/abstract-whitespace-tokenization-mapping branch from 5f4d1ee to 7eb3030 Compare May 21, 2026 22:13
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from ae6030c to c647016 Compare May 21, 2026 22:22
@keyman-server keyman-server modified the milestones: A19S29, A19S30 May 23, 2026
@jahorton jahorton force-pushed the change/web/abstract-whitespace-tokenization-mapping branch from 7eb3030 to 549b114 Compare May 28, 2026 20:52
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from 9dbd2b1 to 0441520 Compare May 28, 2026 21:01
@keymanapp-test-bot keymanapp-test-bot Bot changed the title change(web): rework traversalless prediction, add mild whitespace-correction 🚂 change(web): rework traversalless prediction, add mild whitespace-correction 🚂 🔪 May 28, 2026
@jahorton jahorton force-pushed the change/web/abstract-whitespace-tokenization-mapping branch from 549b114 to 6374711 Compare May 28, 2026 21:20
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from 0441520 to baca01f Compare May 28, 2026 21:28
@jahorton jahorton changed the base branch from change/web/abstract-whitespace-tokenization-mapping to refactor/web/correction-sequence-construction May 28, 2026 21:28
@jahorton jahorton force-pushed the refactor/web/correction-sequence-construction branch from 581115f to bc3691e Compare June 1, 2026 21:02
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from baca01f to 59f58ac Compare June 1, 2026 21:09
@jahorton jahorton force-pushed the refactor/web/correction-sequence-construction branch from bc3691e to b6ba677 Compare June 2, 2026 14:23
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from 59f58ac to d4adfcb Compare June 2, 2026 14:26
@keyman-server keyman-server modified the milestones: A19S30, A19S31 Jun 8, 2026
@jahorton jahorton force-pushed the refactor/web/correction-sequence-construction branch from b6ba677 to 0e52f6f Compare June 11, 2026 16:20
jahorton added 5 commits June 11, 2026 11:52
…rection

Build-bot: skip build:web
Test-bot: skip
Aims:
- improve consistency between Traversal-based models and legacy/custom models without Traversals
- improve ability to unit-test construction of the correction-sequence directly, as a smaller, individual unit
@jahorton jahorton force-pushed the refactor/web/correction-sequence-construction branch 2 times, most recently from e789e1b to e76b338 Compare June 11, 2026 16:53
@jahorton jahorton force-pushed the change/web/rework-traversalless-prediction branch from d4adfcb to 808c598 Compare June 11, 2026 16:54
@jahorton jahorton requested a review from ermshiperete June 11, 2026 19:37
@jahorton jahorton marked this pull request as ready for review June 11, 2026 19:37
@keyman-server keyman-server modified the milestones: A19S31, A19S32 Jun 22, 2026
Base automatically changed from refactor/web/correction-sequence-construction to epic/boundary-correction June 22, 2026 13:49
@jahorton jahorton merged commit 433641d into epic/boundary-correction Jun 22, 2026
7 of 8 checks passed
@jahorton jahorton deleted the change/web/rework-traversalless-prediction branch June 22, 2026 13:50
@github-project-automation github-project-automation Bot moved this from Todo to Done in Keyman Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants