-
Notifications
You must be signed in to change notification settings - Fork 4
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
Conversation
@@ -490,6 +490,7 @@ def comment_spell_check(args): | |||
|
|||
|
|||
def main(): | |||
"""Main function to run the spell checker.""" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
No description provided.