change(web): rework traversalless prediction, add mild whitespace-correction 🚂#15920
Draft
jahorton wants to merge 3 commits into
Draft
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
7539b3e to
6c1170d
Compare
f8a1e49 to
daea6e5
Compare
jahorton
commented
May 14, 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; |
Contributor
Author
There was a problem hiding this comment.
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.
da7359e to
a800a12
Compare
dacfc13 to
8227b81
Compare
jahorton
commented
May 15, 2026
| }); | ||
|
|
||
| const predictions = predictFromCorrections(model, correctionDistribution, context); | ||
| const predictions = correctAndEnumerateWithoutTraversals(model, correctionDistribution, context); |
Contributor
Author
There was a problem hiding this comment.
TODO: heavy cleanup needed here - we probably need tests for both predictFromCorrections AND for correctAndEnumerateWithoutTraversals.
jahorton
commented
May 15, 2026
| const predictions: CorrectionPredictionTuple[] = tailPredictions.map((p) => { | ||
| // Concat corrections + predictions for their components. | ||
| const predictionSequence = [...predictionPrefixSequence, p]; | ||
| const fullPrediction: ProbabilityMass<Suggestion> = predictionSequence.reduce((prev, curr) => { |
Contributor
Author
There was a problem hiding this comment.
See #15907 - this is somewhat similar to the compositeIntermediatePredictions function defined therein. May be worth hoisting, then polishing up later in the PR chain?
To better handle inputs that shift the word-boundary in some custom models and models released before Keyman 14.0, this PR provides generalized re-use of the whitespace-based token-transition algorithm used for our most prominently-supported models. Build-bot: skip build:web Test-bot: skip
a800a12 to
c12cef9
Compare
…rection Build-bot: skip build:web Test-bot: skip
f377066 to
95f3df3
Compare
c12cef9 to
5f4d1ee
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🚧
Build-bot: skip build:web
Test-bot: skip