-
-
Notifications
You must be signed in to change notification settings - Fork 122
refactor(web): new method - attemptTokenizedAlignment 🚂 #14364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jahorton
merged 1 commit into
epic/autocorrect
from
refactor/web/attempt-tokenized-alignment
Jul 24, 2025
Merged
refactor(web): new method - attemptTokenizedAlignment 🚂 #14364
jahorton
merged 1 commit into
epic/autocorrect
from
refactor/web/attempt-tokenized-alignment
Jul 24, 2025
Conversation
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
Following from #14363, this method performs context alignment calculations that may be used to match forms of the context before and after an edit by aligning their tokens and validating any edits that may have occurred. Note that no 'tracked context' states are manipulated or altered by this method - it solely calculates the alignment deltas needed to align the two contexts. Other methods may then take these values and determine the edits that occurred during the associated context transition as needed. Note that the `attemptTokenizedAlignment` method is not integrated into the main codebase for the predictive-text worker at this time. That said, this method _does_ integrate the `isSubstitutionAlignable` method introduced by #14363.
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
jahorton
added a commit
that referenced
this pull request
Jul 15, 2025
…dAlignment method Following from #14364, this PR integrates the new method with the main predictive-text context-tracking code, significantly reworking the `attemptMatchContext` method in the process. While further refactoring of the latter method is planned, this step allows us to verify that the new methods integrate properly with the main codebase in their current form. This also comes with the benefit of simplifying `attemptMatchContext` _significantly_ - large parts of its code were refactored into `attemptTokenizedAlignment`, and the new logic patterns are generally more straightforward to parse and understand.
ermshiperete
approved these changes
Jul 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if(tailInsertLength > 0 && tailDeleteLength > 0) { | ||
// Something's gone weird if this happens; that should appear as a substitution instead. | ||
// Otherwise, we have a VERY niche edit scenario. | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to log this case?
web/src/engine/predictive-text/worker-thread/src/main/correction/context-tracker.ts
Show resolved
Hide resolved
Base automatically changed from
feat/web/is-substitution-alignable
to
epic/autocorrect
July 24, 2025 14:59
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.
Following from #14363, this method performs context alignment calculations that may be used to match forms of the context before and after an edit by aligning their tokens and validating any edits that may have occurred.
Note that no 'tracked context' states are manipulated or altered by this method - it solely calculates the alignment deltas needed to align the two contexts. Other methods may then take these values and determine the edits that occurred during the associated context transition as needed.
Note that the
attemptTokenizedAlignment
method is not integrated into the main codebase for the predictive-text worker at this time. That said, this method does integrate theisSubstitutionAlignable
method introduced by #14363.@keymanapp-test-bot skip