how to run this code?
shubham-dua opened this issue · comments
when i run the init.py file the following error is generated:
Traceback (most recent call last):
File "C:\Python27_init_.py", line 11, in
main()
File "C:\Python27_init_.py", line 6, in main
spellchk.run(sys.argv[1])
IndexError: list index out of range
If you take a look at spellcheck.py
it imports the Unix list of words you can find at /usr/share/dict/words
, which is explained here. Seeing you're on Windows, you can find that list online, or create it yourself and replace the import path in __init__.py
to the path to your file.
Before:
spellchk = SpellCheck('/usr/share/dict/words')
After:
spellchk = SpellCheck("C:\Users\your\path\words.txt")
Once you do that, run it with either a 0
or 1
for the mode. 0
allows you to input your own misspelled words, while 1
generates misspelled words.
python __init__.py 0
I've attached a sample list of words you can use: words.txt