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

Add support for checking if a word is in dict w/o normalizing case #189

Open
jamesqo opened this issue Feb 20, 2018 · 1 comment
Open

Add support for checking if a word is in dict w/o normalizing case #189

jamesqo opened this issue Feb 20, 2018 · 1 comment

Comments

@jamesqo
Copy link

jamesqo commented Feb 20, 2018

I have an application where I want to detect if a given word is an acronym. The way I would like to do this is to do a case-sensitive search for the uppercased string in the dict, e.g. given 'json' convert to 'JSON' and do a case-sensitive search for that. However, enchant_pwl_check is lower-casing the word so I may get false positives.

I just looked through the code, and there seem to be 2 ways to handle this:

  1. Add a gboolean normalizeCase flag to the enchant_pwl_check (This would break binary compatibility?)
  2. Expose enchant_pwl_contains in the header file

I'll submit a PR for both of these options soon.

@rrthomas
Copy link
Contributor

rrthomas commented Feb 25, 2018

I agree that exposing enchant_pwl_contains seems the simplest thing to do.

You added a FIXME that it doesn't refresh the word-list. But this is quite easy to work around: first, check with enchant_pwl_check, and if it returns true, then follow up with enchant_pwl_contains (in case it was a false positive).

I'm happy to help land this patch. For starters, please could you get the patch to pass the existing tests, and add some new tests for enchant_pwl_contains?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants