Download this file.
Feb 23, 16:25 - Ping (line 12): Oops, that's a typo.
Please log in if you would like to add comments. | |
1 | def striphelper(inchar): | 2 | if inchar.isalpha() or inchar=="'": | 3 | return inchar | 4 | else: | 5 | return " " | 6 | | 7 | def strippunctuation(instring): | 8 | return "".join(map( striphelper, instring )) | 9 | | 10 | def misspelledWords( instring ): | 11 | retlist = [] | 12 | newstring = strippunctuatoin( instring ) | 13 | dictfile = open( "dict.txt" ) | 14 | wordlist = dictfile.read().split() | 15 | for w in newstring.split(): | 16 | if wordlist.count(w)==0: | 17 | retlist.append(w) | 18 | return retlist |
|