feat(web): adds finalizer quotient-node type for facilitating multi-word corrections 🚂#15855
Open
jahorton wants to merge 3 commits intofeat/web/search-space-node-propagationfrom
Open
feat(web): adds finalizer quotient-node type for facilitating multi-word corrections 🚂#15855jahorton wants to merge 3 commits intofeat/web/search-space-node-propagationfrom
jahorton wants to merge 3 commits intofeat/web/search-space-node-propagationfrom
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
cf60a5e to
4c102d4
Compare
jahorton
commented
Apr 17, 2026
Comment on lines
+440
to
+462
| const tokenizations = [fixture.theref, fixture.the_ef]; | ||
| const correctors = tokenizations.map((t) => new TokenizationCorrector(t, t.tokens.length, fixture.filter)); | ||
|
|
||
| let haveSeenSingleTokenCorrection = false; | ||
| let haveSeenThreeTokenCorrection = false; | ||
| for await(let phraseMatch of getBestMatches< | ||
| ReadonlyArray<TokenResult>, | ||
| TokenizationResultMapping, | ||
| TokenizationCorrector | ||
| >(correctors, buildTestTimer())) { | ||
|
|
||
| if(phraseMatch.matchedResult.length == 1) { | ||
| if(!haveSeenSingleTokenCorrection) { | ||
| assert.sameOrderedMembers(phraseMatch.matchedResult.map((t) => t.matchString), ['theref' /* -ore */]); | ||
| } | ||
|
|
||
| haveSeenSingleTokenCorrection = true; | ||
| } else if(phraseMatch.matchedResult.length == 3) { | ||
| if(!haveSeenThreeTokenCorrection) { | ||
| assert.sameOrderedMembers(phraseMatch.matchedResult.map((t) => t.matchString), ['the', ' ', 'ef' /* -fort */]); | ||
| } | ||
| haveSeenThreeTokenCorrection = true; | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Ooh, shiny new unit test - one that supports "correcting away" the whitespace! No predictions yet, granted, but this is a major step in the right direction.
(The whitespace is higher probability, for this test, than the r that replaces it.)
57d836b to
bde82ad
Compare
561ad80 to
18ef0a4
Compare
…ord corrections Build-bot: skip build:web Test-bot: skip
18ef0a4 to
2a5f907
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.
As noted in the description of #15818, when correcting multiple tokens together, we will want the ability to restrict some of them to use only corrections. To facilitate this, the new
QuotientNodeFinalizertype allows us to penalize corrections that result in incomplete words, adding one "penalty unit" of cost for each additional codepoint needed to result in an actually-completed word.Build-bot: skip build:web
Test-bot: skip