From 033c4770bed68fad9e6a99e505c1dcf2924c34be Mon Sep 17 00:00:00 2001 From: luk3yx Date: Wed, 3 May 2023 08:26:44 +1200 Subject: Disable spellcheck for now --- spellcheck.py | 51 --------------------------------------------------- spellcheck.py.old | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 spellcheck.py create mode 100644 spellcheck.py.old diff --git a/spellcheck.py b/spellcheck.py deleted file mode 100644 index b3a2b04..0000000 --- a/spellcheck.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Ported from spellcheck.py - Sopel spell check Module -Copyright © 2012, Elad Alfassa, -Copyright © 2012, Lior Ramati - -Licensed under the Eiffel Forum License 2. - -http://sopel.chat -""" - -try: - import enchant -except ImportError: - enchant = None - - -@register_command('spellcheck', 'spell') -def spellcheck(irc, hostmask, is_admin, args): - """ - Says whether the given word is spelled correctly, and gives suggestions if - it's not. - """ - if enchant is None: - irc.msg(args[0], 'Missing pyenchant module.') - return - - word = args[1].rstrip() - if not word: - irc.msg(args[0], 'Usage: .spellcheck ') - return - if ' ' in word: - irc.msg(args[0], 'One word at a time, please') - return - dictionary_us = enchant.Dict('en_US') - dictionary_uk = enchant.Dict('en_GB') - - if dictionary_uk.check(word): - if dictionary_us.check(word): - irc.msg(args[0], f'\u200b{word} is spelled correctly') - else: - irc.msg(args[0], f'\u200b{word} is spelled correctly (British)') - elif dictionary_us.check(word): - irc.msg(args[0], f'\u200b{word} is spelled correctly (American)') - else: - suggestions = {*dictionary_us.suggest(word)[:10], - *dictionary_uk.suggest(word)[:10]} - suggestions_str = ', '.join(f"'{suggestion}'" - for suggestion in sorted(suggestions)) - irc.msg(args[0], f'\u200b{word} is not spelled correctly. ' - f'Maybe you want one of these spellings: ' - f'{suggestions_str}') diff --git a/spellcheck.py.old b/spellcheck.py.old new file mode 100644 index 0000000..b3a2b04 --- /dev/null +++ b/spellcheck.py.old @@ -0,0 +1,51 @@ +""" +Ported from spellcheck.py - Sopel spell check Module +Copyright © 2012, Elad Alfassa, +Copyright © 2012, Lior Ramati + +Licensed under the Eiffel Forum License 2. + +http://sopel.chat +""" + +try: + import enchant +except ImportError: + enchant = None + + +@register_command('spellcheck', 'spell') +def spellcheck(irc, hostmask, is_admin, args): + """ + Says whether the given word is spelled correctly, and gives suggestions if + it's not. + """ + if enchant is None: + irc.msg(args[0], 'Missing pyenchant module.') + return + + word = args[1].rstrip() + if not word: + irc.msg(args[0], 'Usage: .spellcheck ') + return + if ' ' in word: + irc.msg(args[0], 'One word at a time, please') + return + dictionary_us = enchant.Dict('en_US') + dictionary_uk = enchant.Dict('en_GB') + + if dictionary_uk.check(word): + if dictionary_us.check(word): + irc.msg(args[0], f'\u200b{word} is spelled correctly') + else: + irc.msg(args[0], f'\u200b{word} is spelled correctly (British)') + elif dictionary_us.check(word): + irc.msg(args[0], f'\u200b{word} is spelled correctly (American)') + else: + suggestions = {*dictionary_us.suggest(word)[:10], + *dictionary_uk.suggest(word)[:10]} + suggestions_str = ', '.join(f"'{suggestion}'" + for suggestion in sorted(suggestions)) + irc.msg(args[0], f'\u200b{word} is not spelled correctly. ' + f'Maybe you want one of these spellings: ' + f'{suggestions_str}') -- cgit v1.2.3