Skip to content

ENH: Added downoading a dictionary from a URL. #65

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

Merged
merged 1 commit into from
Jul 11, 2025
Merged

Conversation

dave3d
Copy link
Member

@dave3d dave3d commented Jun 30, 2025

No description provided.

@dave3d dave3d force-pushed the LoadDictFromURL branch from ee69dfe to e44ae2d Compare June 30, 2025 19:55
@dave3d dave3d requested a review from zivy June 30, 2025 20:05
@dave3d dave3d force-pushed the LoadDictFromURL branch from 48f738f to 0577277 Compare July 9, 2025 14:34
@dave3d dave3d requested review from blowekamp and zivy July 9, 2025 15:25
@@ -490,6 +490,7 @@ def comment_spell_check(args):


def main():
"""Main function to run the spell checker."""
Copy link
Member

Choose a reason for hiding this comment

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

Please provide some additional information in the comment, otherwise it can be removed. The comment is just underneath the function name "main" and only says "Main function..." which is pretty obvious.

@@ -22,13 +24,44 @@ def create_checker(dict_list: list[str] = None) -> spellchecker.SpellChecker:
english_dict = str(lib_path) + "/resources/en.json.gz"
logger.info("Loading English dictionary from: %s", english_dict)
checker.word_frequency.load_dictionary(english_dict)
logger.info("# of words: %d", checker.word_frequency.unique_words)

# load the additional dictionaries
if not isinstance(dict_list, list):
return checker
Copy link
Member

Choose a reason for hiding this comment

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

I would do:

if dict_list is None:
   return checker

I don't think the if Len below is needed.

except IsADirectoryError:
# if a directory is provided, load all text files in it
for file in d.glob("*.txt"):
try:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just append the globe files to the end of the dict_list

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, that code was suggested by Copilot.

Copy link
Member

Choose a reason for hiding this comment

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

Is there any need to support this directory stuff?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not really, but, hey, if our Copilot AI overlords say it should be there, who are we to disagree?

Copy link
Member

Choose a reason for hiding this comment

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

Please be responsible for the code you commit, and don't create redundant, convoluted overly nested code.

@dave3d dave3d force-pushed the LoadDictFromURL branch from ea82e47 to a088484 Compare July 11, 2025 15:18
@dave3d dave3d merged commit aa21048 into main Jul 11, 2025
2 checks passed
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.

3 participants