question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

case_sensitive=True gives unexpected results

See original GitHub issue

In a case-sensitive dictionary, I would expect 'FBI' to be known and 'fbi' to be unknown. However, both cases give me 'fbi' as known:

from spellchecker import SpellChecker

spell = SpellChecker(case_sensitive=True)

print(spell.known(["FBI"]))
print(spell.known(["fbi"]))
{'fbi'}
{'fbi'}

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nschloecommented, Apr 4, 2022

Thanks for the info!

0reactions
barrustcommented, Apr 4, 2022

To use a case_sensitive dictinoary, you will need to build it yourself as the default dictionaries are case-insensitive. There are lots of ways to build dictionaries, and they are not manually. I only used that to ensure that there wasn’t a bug. You can find the different ways to build a custom dictionary in the documentation on building a new dictionary or in the GitHub Discussion #90.

Either way, there are reasons why the default dictionaries are not capitalized:

  • Reduce the number of characters to calculate all the differences
  • Reduces the number of words to check (The vs. the) since the same word may be capitalized, say due to being the first word in the sentence.
  • The library does not take into account the type of word (entity, verb, adverb, etc) and thus cannot determine if the word being checked should be capitalized or not.

Just some thoughts on it; good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Why I am getting different result from two almost equal ...
It will return true regardless of case. The second example calls ToList so it is now doing a .net string compare what IS...
Read more >
Subtle Mistakes in IDL Programming - L3Harris Geospatial
Blog provides a list of common mistakes in IDL programming, specifically subtle mistakes that can lead to unexpected results & cause ...
Read more >
How to do case-insensitive and accent-insensitive search in ...
You can find that group by and order by queries give incorrect results. Remember this happens silently. Beware! If you are using extended...
Read more >
enable case sensitive for values in dashboard. - Splunk Answers
I want to treat "some value" as case insensitive in the dasboard. The dashboard gets filled on the basis of drop down selection....
Read more >
Solved: Using 'contains' with Case Sensitivity
Solved: Is anyone aware of a change to the 'contains' operator toLower(outputs('Update_item')?['body/Transferee_x0020_Email']) We have ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found