Closed jahorton closed 3 years ago
To Reproduce Seriously... just type a keystroke whenever a lexical model is active. A breakpoint near the beginning of the method and at the end of the method will provide sufficient comparison.
Could you give an example with a specific model, expected and actual results please? This is a little too abstract right now.
One quick and easy one: with English active, type "bxo".
An obvious expected correction: "box".
Actual results: sometimes "BDO" shows up; no other suggestions whatsoever appear.
I designed the thing to do transpositions (reordering the 'x' and 'o'), so that's really concerning to me. I could understand if the transposition were overridden by higher probability suggestions, but not... just not appearing.
After further investigation, I can see that a few effects are contributing to this:
Describe the bug A spot of aliasing with "keep" suggestions is causing unexpected side-effects within the context-tracking system part of the lm-layer. The side effect that results is, unfortunately, quite nasty; certain correction types (like transpositions!) are completely broken as a result. (Rule of thumb: the 'graph edge' leading to the correction must have been computed in a previous pass, before the aliasing was able to affect the results.)
I've traced the issue to these two blocks:
https://github.com/keymanapp/keyman/blob/6c9fe2c9fe3cedfc9917c59867a4e83a8d300c88/common/predictive-text/worker/model-compositor.ts#L342-L346
In the block above, one of the suggestions was actually using the same
Transform
instance as the keystroke that triggered the prediction. Modifying that instance thus modified the keystroke'sTransform
... which naturally led to nasty side-effects.https://github.com/keymanapp/keyman/blob/6c9fe2c9fe3cedfc9917c59867a4e83a8d300c88/common/predictive-text/worker/model-compositor.ts#L292-L300
The block above is the culprit.
To Reproduce Seriously... just type a keystroke whenever a lexical model is active. A breakpoint near the beginning of the method and at the end of the method will provide sufficient comparison.