Closed Bug 1048869 Opened 10 years ago Closed 10 years ago

Keyboard autosuggest nearby keys algorithm doesn't value vertical alignment enough

Categories

(Firefox OS Graveyard :: Gaia::Keyboard, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: janjongboom, Assigned: janjongboom)

References

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
djf
: review+
rudyl
: feedback+
Details | Review
In the nearby keys algorithm keys that are horizontal adjacent next to each other are valued way higher than vertical. This is why we get suggestions like this (from bug 981602):


INPUT            SUGGESTION         SHOULD BE
==============================================
kn               km*                in* (because in has freq 210, km has 155)
asjan            Ashanti*           Asian (126 vs 77, plus word length mismatch)
flr              DLR*               for* (196 vs 83)

We should fix the nearby keys algorithm so it has these cases correct.
Assignee: nobody → janjongboom
Attached file Patch
Another one in the series. This patch values keys that are vertically stacked a bit more. The problem is that the difference between horizontal and vertical keys in value is too much. E.g. distance between F & G is 0.70, and between F & C 0.27. Even though they're both adjacent to F. The difference between F & T then almost doesn't differ from C, with only 0.25. Because we treat this value as a direct multiplier to matches, matches with horizontal key get a way too high valuation leading to the errors in the description.

The reason for this is that we measure the delta between the center of the keys, and as a key is higher than wider we get this unfair penalty. Should normalize the delta in both ways, which is what this patch does.

With this patch, the values for 'F' are:

G 0.70
C 0.49
T 0.42

Which is more reasonable I think.
Attachment #8468373 - Flags: review?(dflanagan)
Comment on attachment 8468373 [details] [review]
Patch

I don't have time to test this out myself, but if you think it gives better corrections, let's go with it. But please add a comment to your patch explaining why you're adjusting dy and the mathematical justification for that particular adjustment.
Attachment #8468373 - Flags: review?(dflanagan) → review+
Comment on attachment 8468373 [details] [review]
Patch

Rudy, can you give feedback on this before I land it?
Attachment #8468373 - Flags: feedback?(rlu)
Comment on attachment 8468373 [details] [review]
Patch

I'm fine with this change and tested it on the phone.
Thanks.
Attachment #8468373 - Flags: feedback?(rlu) → feedback+
You need to log in before you can comment on or make changes to this bug.