change(web): track the base correction for generated predictions 📚 #11875
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.
This PR serves to facilitate autocorrect.
After some brainstorming and design work, I've determined that a suggestion's underlying correction will be an important factor in deciding whether or not to enable the suggestion for automatic application. While it is possible to recompute some of the properties after the fact, the logic will be much more straightforward if we properly track each prediction's underlying correction from the outset.
While making the change, I remembered a comment from one of my recent PRs: #11424 (comment)
(In regard to
lexical-p
,correction-p
, etc)We're able to more cleanly compute these values now. Additionally... we don't really need to emit them during standard use, though they are useful sometimes when debugging... so I added a flag that can be used to turn them off. Allowing this to be toggled by Keyman Engine for Web would require additional work, but it's at least a start. (I don't think they'll actually be needed outside of the worker, even with active autocorrect.)
@keymanapp-test-bot skip