keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
378 stars 106 forks source link

bug(common/models): predictions are not always giving useful results #6985

Closed mcdurdin closed 4 months ago

mcdurdin commented 1 year ago

Describe the bug

This may be a problem with web rather than android.

Starting at 0:44 in the attached video, is the most obvious example, although there may be others that are less obvious. I finish the word problen but am not offered any predictions. I delete the n and then am offered problem. Retyping either n or m again offers no predictions. On the following word, you can see how I type problen and am offered problem as a correction.

https://user-images.githubusercontent.com/4498365/180669638-5f7651da-15b8-43fe-94d0-2e3dc36120bf.mp4

To Reproduce

  1. Type rapidly. At some point, predictions will either not be offered, or will offer unhelpful options.

Expected behavior

Consistent suggestions, particularly e.g. if I have typed problem or problen, say, then problem, problems, problematic should really always be offered!


Keyman for iPhone/iPad/Android:


Keyboard

Additional context

jahorton commented 1 year ago

... I finish the word problen but am not offered any predictions.

I have seen this sort of thing happen at times. My first instinct is that my keystroke touchpoints were too consistently off-center, but it's possible something's there. (More on that "first instinct" comes later in this reply.) Checking this "instinct" and its relation to this issue in high detail would require logging and analyzing the fat-finger probability distributions involved.

... I delete the n and then am offered problem. Retyping either n or m again offers no predictions.

Yeah, the last part of that is definitely suspect. A backspace is supposed to eliminate the probability weighting data for previously-typed keys and set them as "known", so there's no reason that the follow-up keystroke should no longer offer "problem" as a suggestion in this scenario unless corrections are disabled.

On the following word, you can see how I type problen and am offered problem as a correction.

... which confirms you don't have corrections disabled, hence why I said "definitely suspect."

Consistent suggestions, particularly e.g. if I have typed problem or problen, say, then problem, problems, problematic should really always be offered!

If the keystrokes are reasonably and consistently placed. Keep in mind that we care about where on the key each key is pressed when determining suggestions; this affects the underlying probability weightings and can cause sequences of consistently off-center keystrokes to fall prey to internal 'thresholding' that helps keep predictive text reasonably performant. (The thresholding's designed to help it avoid wasting time on "rabbit trails" and keep it reasonably focused.)

mcdurdin commented 1 year ago

If the keystrokes are reasonably and consistently placed.

I dunno. I think it's reasonable for the end user to assume that having typed problem, they'll be offered problems, even if it is slightly fatfingered...

That is, while I can see scenarios where shorter words may offer a very common fat fingered alternative, but once we get to the 7 letters of problem, I really think that it is unlikely that a fat fingering option is going to have that much higher a probability than that valid word problem that the user has actually typed, to the point where problems is thresholded out of the picture? I hear ya but if our algorithm is dropping problems because it's outside the threshold, then that's not good.

jahorton commented 1 year ago

Upon investigating some of the instability noted with the predictive-text engine's unit tests, I think the most inconsistent one might actually be related to some aspects of this. So, a potential "two birds, one stone" mitigation/fix: #7037.

darcywong00 commented 1 year ago

Consistent suggestions, particularly e.g. if I have typed problem or problen, say, then problem, problems, problematic should really always be offered!

"problematic" is in the mtnt wordlist (frequency of 40). I tried the KeymanWeb prediction-ui test page on the master branch.

After typing "problema", the only two suggestions ever offered are "problems" or "problem".

MakaraSok commented 1 year ago

This issue cannot be repro consistently on Android 11, Galaxy S9+, on both Keyman Alpha and Stable.

mcdurdin commented 4 months ago

This is adequately fixed in v17.0, as far as I can tell. @jahorton which PR resolves this?

jahorton commented 4 months ago

If I had to pick, I'd go with #10330. That gave us far better performance, which certainly helped to stabilize things.

mcdurdin commented 4 months ago

Fixed by #10330.