Skip to content
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

Support user dictionary in suggestions #2132

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

moonbeamcelery
Copy link
Contributor

@moonbeamcelery moonbeamcelery commented Dec 12, 2022

This PR adds custom-defined dictionary into the suggestions for both Latin and HanShapeBased providers, and the fallback one.

This is again based on #2054 and includes changes from #2093. For now, only the last commit is specific to this PR rebased on to master.

TODO:

  • Add default language values to the entries based on which screen the user is on. ✔️ done
  • Fix bugs in Latin that (1) auto-commits, and (2) matches empty text and non-starting positions (feature or a bug?). ✔️ done
  • The added quick action does not show up unless you delete the app's data and start over. Need to fix. ✔️ done

Update: fixed these issue and added a quick action button to add things to the internal user dictionary.

@moonbeamcelery
Copy link
Contributor Author

moonbeamcelery commented Dec 13, 2022

TODO: fix bugs in Latin that (1) auto-commits, and (2) matches empty text and non-starting positions (feature or a bug?).

Any suggestions on what to do with the current behavior of matching non-starting positions? e.g. when tiramisu is in the user dictionary, an input of mis would fetch the tiramisu suggestion. Do you want this behavior to stay or can I change it to only match the beginning of an entry?

@moonbeamcelery moonbeamcelery force-pushed the zh-shape-layouts-user-dict branch 2 times, most recently from 1485a66 to ff8c3a9 Compare January 16, 2023 08:23
@Turhvjbufv
Copy link

Does it have an estimated finish date?

@moonbeamcelery
Copy link
Contributor Author

Not really, this heavily interacts with the autocorrect and suggestion implementation that Patrick is working on. When that is done, this can be rewritten and become ready.

@patrickgold
Copy link
Member

Any suggestions on what to do with the current behavior of matching non-starting positions? e.g. when tiramisu is in the user dictionary, an input of mis would fetch the tiramisu suggestion. Do you want this behavior to stay or can I change it to only match the beginning of an entry?

Tbh if the user enters "mis" he/she probably didn't meant to enter "tiramisu", so it would make sense to match the beginning only. In my currently unrelased NLP core this problem has been addressed differently through proximity matching (but in your example it would not suggest "tiramisu" for "mis" as input either because it is not even close to the beginning of the word), however for the scope of the feature you implement I think it is more than enough to do exact matches on the beginning only.

@Turhvjbufv
Copy link

Any suggestions on what to do with the current behavior of matching non-starting positions? e.g. when tiramisu is in the user dictionary, an input of mis would fetch the tiramisu suggestion. Do you want this behavior to stay or can I change it to only match the beginning of an entry?

Tbh if the user enters "mis" he/she probably didn't meant to enter "tiramisu", so it would make sense to match the beginning only. In my currently unrelased NLP core this problem has been addressed differently through proximity matching (but in your example it would not suggest "tiramisu" for "mis" as input either because it is not even close to the beginning of the word), however for the scope of the feature you implement I think it is more than enough to do exact matches on the beginning only.

Maybe make it an option to toggle it on/off

@moonbeamcelery
Copy link
Contributor Author

moonbeamcelery commented Mar 30, 2023

Update: fixed these issue and added a quick action button to add things to the internal user dictionary. The added quick action does not show up unless you delete the app's data and start over. Need to fix. ✔️ fixed

Signed-off-by: moonbeamcelery <moonbeamcelery@proton.me>
…items. Match locale prefix (e.g. entries for en available for en_US subtype).

Signed-off-by: moonbeamcelery <moonbeamcelery@proton.me>
… dictionary item fields.

Signed-off-by: moonbeamcelery <moonbeamcelery@proton.me>
val oldArrangement = QuickActionArrangement.Serializer.deserialize(entry.rawValue)
val newDefault = QuickActionArrangement.Default

// FIXME: what is the canonical equality for two quick actions? Using .keyData().code for now.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that for QuickActionArrangement setting migration, we add newly available action tiles. But the correspondence is determined by .keyData().code, as QuickActionArrangement.contains() seems to compare by object reference or something

@moonbeamcelery
Copy link
Contributor Author

This PR technically is ready to merge if I do not find any issue in the next few days. But it may be more convenient to merge after the suggestion engine is ready and after adapting this PR to that version.

@daakru
Copy link

daakru commented Apr 1, 2023

@moonbeamcelery is there any plan to take suggestions from the system user dictionary as well?

@moonbeamcelery
Copy link
Contributor Author

@moonbeamcelery is there any plan to take suggestions from the system user dictionary as well?

FlorisBoard supported that before, and this PR enables that as well. I just didn't add a quick action button for it.

@moonbeamcelery moonbeamcelery marked this pull request as ready for review April 4, 2023 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants