From dfde0de3ebfc154f093c3b4f9f1f6ab5c16c568c Mon Sep 17 00:00:00 2001 From: linudaemon Date: Wed, 14 Aug 2019 15:42:37 -0500 Subject: [PATCH] Remove spellcheck.py due to pyenchant going unmaintained --- plugins/spellcheck.py | 44 ------------------------------------------- requirements.txt | 1 - 2 files changed, 45 deletions(-) delete mode 100644 plugins/spellcheck.py diff --git a/plugins/spellcheck.py b/plugins/spellcheck.py deleted file mode 100644 index 195dcb10c..000000000 --- a/plugins/spellcheck.py +++ /dev/null @@ -1,44 +0,0 @@ -from enchant import Dict -from enchant.checker import SpellChecker -from enchant.tokenize import EmailFilter, URLFilter - -from cloudbot import hook - -locale = "en_US" -en_dict = Dict(locale) - - -@hook.command() -def spell(text): - """ - Check spelling of a word or sentence.""" - if len(text.split(" ")) > 1: - # input is a sentence - checker = SpellChecker(en_dict, filters=[EmailFilter, URLFilter]) - checker.set_text(text) - - offset = 0 - for err in checker: - # find the location of the incorrect word - start = err.wordpos + offset - finish = start + len(err.word) - # get some suggestions for it - suggestions = err.suggest() - s_string = '/'.join(suggestions[:3]) - s_string = "\x02{}\x02".format(s_string) - # calculate the offset for the next word - offset = (offset + len(s_string)) - len(err.word) - # replace the word with the suggestions - text = text[:start] + s_string + text[finish:] - return text - # input is a word - is_correct = en_dict.check(text) - suggestions = en_dict.suggest(text) - s_string = ', '.join(suggestions[:10]) - if is_correct: - return '"{}" appears to be \x02valid\x02! (suggestions: {})'.format( - text, s_string - ) - - return '"{}" appears to be \x02invalid\x02! (suggestions: {})'.format( - text, s_string - ) diff --git a/requirements.txt b/requirements.txt index b72fda80a..c3454e770 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,6 @@ multidict==4.5.2 nltk==3.4.4 psutil==5.6.3 py-irclib==0.2.1 -pyenchant==2.0.0 requests==2.22.0 SQLAlchemy==1.3.7 tweepy==3.8.0