File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88from theobot import password
99from theobot import bot
10+ from theobot import spellcheck
1011
1112from itertools import groupby
1213import collections
@@ -80,13 +81,20 @@ def paragraph(lines):
8081 if not re .search (r"""(sfn|\<ref)""" ,p ) and len (p ) > 100 : # only look at paragraphs longer than 100 chars
8182 alerts .append ("\n * ''(beta)'' Lacking a citation in the paragraph beginning {{{{xt|{}...}}}}" .format (p [:70 ]))
8283
84+ # check for common misspelled words from [[Wikipedia:Lists of common_misspellings/For machines]]
85+ print "Checking for misspelled words..."
86+ sp = []
87+ for spell_tuple in spellcheck .Misspellings (text ).check ():
88+ #for spell_tuple in spellcheck.Misspellings(text).check():
89+ sp .append ("\" {0}\" (line {1})" .format (spell_tuple [1 ],spell_tuple [0 ]))
90+ if len (sp ) > 0 :
91+ alerts .append ("\n * Common typo(s) or misspelling(s) detected: " + ', ' .join (sp ))
92+
8393 if len (alerts ) > 0 :
8494 results += '' .join (alerts )
8595 else :
8696 results += "\n ''There are no alerts for this page.''"
8797
88- # !todo misspelled words?
89-
9098 return results
9199
92100def cleanup (text ):
You can’t perform that action at this time.
0 commit comments