-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: fuzzy matching #8
Comments
There is some degree of fuzzy matching already. If you have the hunspell dictionaries installed and On top of that, matching is accent insensitive, i.e. if you type in a Is that what you meant? |
What I mean is that if I type "hm" I will also get a match for "home", similar to how, for example, https://github.com/junegunn/fzf works. |
For something as short as "hm" that will easily give far too many matches. If you have too many matches to choose from, speed will suffer. |
Can you please elaborate on the speed issues you expect with lots of matches? |
I mean the speed issues of the user having to select from too many Lots of matches can be useful only in rare cases, like when trying to Swiftkey, a similar program to speed up typing which runs on Android The scoring is done by remembering what the user types often. For example, if you often type “I want beer” and less often type “I Try this out by typing a few sentences and then type similar If you type a word completely but spelled wrong, for example if you |
Thanks @mike-fabian for the thorough explanation! The way I see it, the problem you describe with having to scan a long list of candidates is more about scoring/ranking than matching. If you think about it, (boolean) matching can be viewed as some form of scoring as well (where matches get the score 1 and non-matches get 0, assuming you show the user all words with score > 0). |
@mike-fabian @infokiller I have extracted the Android auto-suggestion and correction library from the last open source release of the Android (now Google) keyboard. It is basically a C++ library. I am working on nice Python bindings. You can check it out here: https://github.com/wolfv/suggestr My initial version from a couple years ago also had a DBus Server, which we could easily revamp to make it work. I don't know the exact model how ibus-typing booster retrieves suggestions but I think using the Android keyboard sources is ideal. It is very fast, supports the usage of context, comes with a couple of good dictionaries (that have probabilities). Maybe someone has a cycle or two to try to get it to work together? I think this would be a game-changer, not only for ibus-typing-booster, but also for touchscreen keyboards in Gnome (and upcoming phones). |
@wolfv sounds great, I agree that the Android keyboard is a good direction!
What did you use a dbus server for?
By "get it to work together", do you mean combining suggestr with ibus-typing-booster? |
That means the current version is not open source anymore?
I’ll have a look. But I was never really impressed by the prediction quality of the Android keyboard, SwiftKey seems to work much better. |
yes, at some point in time google decided to create a close-sourced fork of the keyboard, and rebrand it as Google Keyboard. Some features (such as swipe-to-type) have never been available in the open source version, although some code fragments for this feature can be found in the source code. Well ... if you find the sources for SwiftKey somewhere, sure, that might be better. But it's not a trivial piece of software so I think we should work with what we got :) Everything is going to be quite a step up from the current approach of using Hunspell (which doesn't factor in the keyboard layout, for example, and doesn't offer any real predictive capabilities, as well as not taking into account the context). I'd be excited if you give it a shot, even though my stuff is also not really "finished". Regarding the DBus server: this was just an experiment to create some API to the code. I used it to get suggestions into UberWriter (as a prototype). The Python interface will be much more powerful and we'll be able to create DBus or other bindings going from there. |
Factoring in the keyboard layout is more difficult on the desktop because you don't know what the keyboard layout actually is, usually. |
The current approach is not only hunspell, that is a sort of last ditch fallback if no learned data is available yet. And of course hunspell gives spellchecking suggestions. Preditions in ibus-typing-booster at the moment rely mostly on what the user has typed in the past already and it does take context into account. Only if nothing can be found in the user database for that context, hunspell predictions end up at the top of the prediction list. Usually I see predictions from my user database at the top of the prediction list. |
Ok, then I probably haven't tried it for long enough, sorry about that. Locally I have example code for the I think most keyboard layouts are fairly standard, and the layouts are also configurable. Exact matching layouts might not be required, but the knowledge which keys are next to each other can help a good bit for getting fitting results IMO (that's likely also how SwiftKey and anybody else does it). |
Some keyboards like the French one for example are very different. |
Sure - you can dynamically switch Layouts with the android keyboard sources. here is (the only) currently included definition: https://github.com/wolfv/suggestr/blob/master/prediction/key_set.h Will need to figure out how to properly modify this to support other layouts then QWERTY but it can certainly be done :) Also, of course, touch and regular keyboards are somewhat different, so maybe it would be good to tune some other geometric values -- but on the other hand I think out of the box this will give nice predictions. |
Here is more work (apparently with dynamic keyboard layouts) in the Chromium sources: https://chromium.googlesource.com/chromiumos/platform/suggest/+/refs/heads/master/src/demo.cc |
@mike-fabian I have just added support for reading in arbitrary layouts (in Python), you can find an example Notebook using the German keyboard layout here: https://github.com/wolfv/suggestr/blob/master/notebooks/Example%20Usage.ipynb And the layouts are stored here: https://github.com/wolfv/suggestr/blob/master/layouts/de.yaml Note that these layouts are taken from the squeekboard repo (the Librem 5 soft keyboard). Let me know what you think! |
@mike-fabian did you ever have a chance to look at suggestr? |
Do you think it would be hard to support it?
I think that can make typing much easier on average.
Thanks!
The text was updated successfully, but these errors were encountered: