Commit graph

303 commits

Author SHA1 Message Date
Joshua Horton
2b64a0857b docs(web): fix sourceText doc comment 2025-09-24 10:37:12 -05:00
Joshua Horton
012dcaeee9 refactor(web): differentiate between true and represented inputs for context tokens
To be up-front, this is looking ahead significantly to epic/dict-breaker (#12142) concerns.  The core idea here:  each token should mark which part of the current context it represents - and the best data for the job happens to be the original, true transforms.

With epic/dict-breaker and other possible work that would faciltate considering alternative tokenizations, it is quite possible the original source transform(s) for a tokenization may not actually be represented within that tokenization's input set.

Consider:  if the spacebar appears as a fat-finger alternate for a letter key, we may wish to model an alternate tokenization where we actually _used_ that keystroke as a whitespace instead of a standard letter.  The resulting whitespace token shouldn't have the original letter key's transform as part of its represented inputs for such a case.

Build-bot: skip build:web
Test-bot: skip
2025-09-19 09:27:17 -05:00
Joshua Horton
f7e291a7c3 feat(web): add option to disable transpose edits
Tokens in the active context should not be transposable, so this commit adds an option that permits disabling transpose edits during edit-distance calculation.

Build-bot: skip build:web
Test-bot: skip
2025-09-10 10:52:43 -05:00
Joshua Horton
7ebfbfe54e refactor(web): move static computeDistance to standalone helper
The main goal of this commit is to allow computeDistance to operate properly with both ClassicalDistanceCalculation and SegmentableDistanceCalculation. For now, context alignment via computeAlignment will continue to use the former edit-distance calculation type, but the goal is to convert to use of the latter and its support for 'split' / 'merge' edit operations in the near future.

Build-bot: skip build:web
Test-bot: skip
2025-09-10 10:50:19 -05:00
Joshua Horton
47c1310f8d refactor(web): improve encapsulation for edit-distance calculation objects
Build-bot: skip build:web
Test-bot: skip
2025-09-10 10:16:37 -05:00
Joshua Horton
c56206c3f1 feat(web): support partial split + merge edits
After a bit of thought, I realized that it's feasible to support certain kinds of "partial" splits and edits.  If the only missing portion is entirely on one end or the other of the "combined" token, that isn't costly to compute - and it very much matches the specific cases that motivated 'merge' / 'split' support to begin with.

Suppose the word `can't` is partially in the context, at the start of the sliding context window.  Sliding backward one character at a time and using our default wordbreaker, we'd get...
- `t`
- `'`, `t`
- `n't`

`n't` is a "partial merge" scenario - we're missing the 'n', but the rest of the pieces are present.  The new changes allow us to detect that `'` and `t` combine as part of the `n't` token.

Note that this still requires a 1-to-many relationship between the "input" and "match" string sequences; there will be no support for a hypothetical "merge-then-split" operation.  (Say, combining 2 and splitting the result into 3 - or vice versa.)
2025-09-10 08:25:50 -05:00
Joshua Horton
5c6a95284a change(web): edit path edges should report alignment indices instead of texts
This change will provide a way to align more directly from edit path data, rather than rely on the post-op guesswork that's been used until now to approximate it.
2025-09-10 08:25:33 -05:00
Joshua Horton
0fbf9c028e feat(web): support split, merge for edit-path construction
Relates-to: #14679

The goal of this PR is to facilitate better handling for token splits and token merges.
2025-09-10 08:25:13 -05:00
Joshua Horton
01d73079a9 refactor(web): better edge-finder typing, cleanup 2025-09-10 08:24:37 -05:00
Joshua Horton
88393c515d refactor(web): refactor edit-path construction to support extensions from subclasses 2025-09-10 08:24:37 -05:00
Joshua Horton
36cee82da8 refactor(web): relocate getMergeSplitParent 2025-09-10 08:23:59 -05:00
Joshua Horton
8ca4b8b3cd feat(web): start support for calculating 'split', 'merge' edits 2025-09-10 08:23:59 -05:00
Joshua Horton
1853af628b refactor(web): refactor distance-calculation method that extends path on new input 2025-09-10 08:23:30 -05:00
Joshua Horton
29f3f8595e feat(web): add unit tests to validate correction setup helpers
This commit adds unit tests for the methods extracted in #14716 designed to help automate testing for work done in #14700 and #14537, among other recent epic/autocorrect PRs.

There's also a very small bit of cleanup of logic that affected one of the new tests.

Build-bot: skip test:web
Test-bot: skip
2025-09-09 14:40:27 -05:00
Joshua Horton
439b9c3f01 refactor(web): spin off determineSuggestionAlignment method 2025-09-09 13:00:37 -05:00
Joshua Horton
eb679488a4 refactor(web): spin off matchBaseContextState, determineContextTransition as helpers 2025-09-09 13:00:37 -05:00
Joshua Horton
db5e77c0dc refactor(web): move traversal-less correction code to own helper 2025-09-09 13:00:37 -05:00
Joshua Horton
a97222e5dd Merge branch 'fix/web/suggestions-after-bksp' into feat/web/delayed-reversions 2025-09-09 08:52:45 -05:00
Joshua Horton
eb43cfa729 Merge branch 'epic/autocorrect' into fix/web/suggestions-after-bksp 2025-09-09 08:32:38 -05:00
Joshua Horton
7b5388125c fix(web): fix transform IDs, appended transform handling for dummy models
Build-bot: skip build:web
Test-bot: skip
2025-09-08 15:56:31 -05:00
Joshua Horton
6c847422df fix(web): patch up unit tests for change to worker reversion pattern 2025-09-08 07:46:11 -05:00
Joshua Horton
eadbfc625f Merge branch 'fix/web/suggestions-after-bksp' into feat/web/delayed-reversions 2025-09-07 21:33:36 -05:00
Joshua Horton
28ade8991d fix(web): better delete-left handing for suggestions when crossing word boundaries 2025-09-07 21:32:08 -05:00
Joshua Horton
7702241a01 change(web): manage reversion display from worker
This prevents display errors associated with reversions that occurred once the worker started supplying reversions as part of prediction requests.

Also hides suggestions / reversions that depend on context states that have aged out of the Web engine's cache.
2025-09-05 14:19:04 -05:00
Joshua Horton
c484311679 feat(web): support reversions after returning to end of applied text
Relates-to: #12884
Relates-to: #12648 (item 3 from the first list)
2025-09-05 14:19:04 -05:00
Joshua Horton
099d4aaff4 fix(web): display suggestions for text reached by backspace 2025-09-05 14:14:55 -05:00
Joshua Horton
eb83fb91bc fix(web): fix immediate application of suggestions following another 2025-09-05 12:16:55 -05:00
Joshua Horton
be25bd3891 fix(web): fix handling of replaced post-accept prediction contexts 2025-09-05 11:06:08 -05:00
Joshua Horton
2881ce6997 Merge branch 'feat/web/punctuation-whitespace-reversion' into feat/web/auto-accept-on-punctuation 2025-09-05 10:23:45 -05:00
Joshua Horton
cf7448a364 change(web): improve handling for reverting appended transform 2025-09-05 10:23:33 -05:00
Joshua Horton
1b74434170 Merge branch 'feat/web/punctuation-whitespace-reversion' into feat/web/auto-accept-on-punctuation 2025-09-05 09:39:26 -05:00
Joshua Horton
7c86659723 Merge branch 'epic/autocorrect' into feat/web/punctuation-whitespace-reversion 2025-09-05 09:38:54 -05:00
Joshua Horton
24db7bd417 fix(web): predict with most recent transition upon receiving empty input 2025-09-04 15:34:37 -05:00
Joshua Horton
7a4f55ac72 Merge branch 'epic/autocorrect' into chore/merge-master-into-autocorrect
In particular, this merges in the recent changes
to `master` from #14618 that adjust the
edit-distance calculation class and simplify its
input format.

These changes intersected with some epic/autocorrect
code added by #14617 and #14462, which needed tweaks
to work correctly with the new format.
2025-09-03 12:37:49 -05:00
Joshua Horton
770a87860a Merge branch 'feat/web/punctuation-whitespace-reversion' into feat/web/auto-accept-on-punctuation 2025-09-03 12:21:33 -05:00
Joshua Horton
eafd32a222 Merge branch 'epic/autocorrect' into feat/web/punctuation-whitespace-reversion 2025-09-03 12:20:57 -05:00
Joshua Horton
04b11dc279
Merge pull request #14673 from keymanapp/fix/web/apply-suggestion-after-multi-whitespace
fix(web): fix suggestion-application when preserved text prepends extra whitespace 🚂
2025-09-04 00:00:43 +07:00
Joshua Horton
6947b3057f
Merge pull request #14670 from keymanapp/fix/web/fat-finger-index-0
fix(web): always place true input at lead of fat-finger distribution 🚂
2025-09-04 00:00:29 +07:00
Joshua Horton
3af5eb604c
Merge pull request #14640 from keymanapp/fix/web/wordbreak-shift-at-head
fix(web): improve context transition handling when wordbreaking shifts at sliding-context start 🚂
2025-09-04 00:00:12 +07:00
Joshua Horton
65dc3733a4
Merge pull request #14617 from keymanapp/feat/web/edit-path-ranking
feat(web): determine all equal-cost edit-paths & rank them by quality 🚂
2025-09-04 00:00:02 +07:00
Joshua Horton
80617bfcad
Merge pull request #14615 from keymanapp/feat/web/visualize-distance-calculation
feat(web): add method that provides visualization for edit-distance calculations 🚂
2025-09-03 23:59:51 +07:00
Joshua Horton
2ec76c70ba
Merge pull request #14575 from keymanapp/change/web/map-transform-tokenization
change(web): map tokenized transform by index relative to context tail 🚂
2025-09-03 23:59:43 +07:00
Joshua Horton
1a1fd79813
Merge pull request #14573 from keymanapp/refactor/web/independent-compute-alignment
refactor(web): move computeAlignment core to standalone method 🚂
2025-09-03 23:59:33 +07:00
Joshua Horton
581e861285
Merge pull request #14476 from keymanapp/fix/web/sliding-tokenization-alignment
fix(web): prevent preserved leading-token text from breaking alignment 🚂
2025-09-03 23:59:22 +07:00
Joshua Horton
2b317689f1
Merge pull request #14558 from keymanapp/fix/web/post-bksp-applies
fix(web): handle suggestion application after backspacing 🚂
2025-09-03 23:59:00 +07:00
Joshua Horton
8d51fbb7f2
Merge pull request #14470 from keymanapp/change/web/cache-states-selectively
change(web): do not cache context states that will no longer be referenced 🚂
2025-09-03 23:58:52 +07:00
Joshua Horton
29fc43e423
Merge pull request #14471 from keymanapp/refactor/web/analyze-state-transition
refactor(web): move attemptMatchContext to ContextState.analyzeTransition 🚂
2025-09-03 23:58:44 +07:00
Joshua Horton
a636b5bb7a Merge branch 'epic/autocorrect' into refactor/web/tokenization-transition 2025-09-03 10:40:56 -05:00
Joshua Horton
78cdfe4cd1
Merge pull request #14443 from keymanapp/change/web/suggestion-tracking
change(web): rework applied-suggestion tracking + reversions 🚂
2025-09-03 22:38:56 +07:00
Joshua Horton
a28fde81b7
Merge pull request #14442 from keymanapp/change/web/cache-context-transitions
change(web): cache context transition objects, not just context state 🚂
2025-09-03 22:38:47 +07:00