-
Notifications
You must be signed in to change notification settings - Fork 506
Case ignore #3272
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
Case ignore #3272
Conversation
Still need to write tests for it though
It should be independent. The implementation of this PR only affects the reading of In fact, the def build_dict(
filename: str,
misspellings: Dict[str, Misspelling],
ignore_words: Set[str],
) -> None:
with open(filename, encoding="utf-8") as f:
translate_tables = [(x, str.maketrans(x, y)) for x, y in alt_chars]
for line in f:
[key, data] = line.split("->")
# TODO for now, convert both to lower. Someday we can maybe add
# support for fixing caps.
key = key.lower()
data = data.lower()
if key not in ignore_words:
add_misspelling(key, data, misspellings)
# generate alternative misspellings/fixes
for x, table in translate_tables:
if x in key:
alt_key = key.translate(table)
alt_data = data.translate(table)
if alt_key not in ignore_words:
add_misspelling(alt_key, alt_data, misspellings)that is, when reading the dictionaries included with codespell, actually everything is already converted into lowercase anyway. |
This comment was marked as resolved.
This comment was marked as resolved.
|
@larsoner Would you like to have a look? |
|
Code changes look reasonable. There is some risk that someone with custom dictionaries will get different behavior with this PR, though. Safest would be to add a switch to make this opt-in like |
So I believe the changes in this PR should only affect words passed by config or command line options, which is why I stated in #3272 (comment) this was independent of #3270. Similarly, there should be no backwards-incompatability with custom dictionaries either, because those are read using The only users who should see any changes are people who have specified, say, something like Please let me know if I misunderstood. |
|
Thanks @vEnhance ! |
Starting on #1578, WIP