Download this file.
Feb 17, 21:36 - Jacob (line 17): I like how you build in the lowercase check!
Feb 17, 21:37 - Jacob (line 12): word has a newline at the end, so unfortunatley all words not ending in a newline will not check correctly :(
Please log in if you would like to add comments. | |
1 | #Thanh Thai
| 2 | #cs198-ak
| 3 | #speling.py
| 4 |
| 5 |
| 6 |
| 7 | file = open("dict.txt")
| 8 | dictionary = {}
| 9 |
| 10 |
| 11 | #convert file (which is a list) into a dictionary
| 12 | for word in file:
| 13 | dictionary[word] = word
| 14 |
| 15 | def splCheck(wd):
| 16 | """ Checks if wd is a word """
| 17 | return dictionary.get(wd, dictionary.get(wd.lower()))
| 18 |
| 19 | def pasCheck(aPassage):
| 20 | """ Checks if all the words in a passage is spelled correctly """
| 21 | pass
| 22 |
| 23 | def specialWord(wd):
| 24 | """ Allows this word to be considered a word """
| 25 | pass
| 26 |
| 27 |
| 28 | def addWord(wd):
| 29 | """ Adds wd (a word) to the dictionary """
| 30 | pass
| 31 |
| 32 | def delWord(wd):
| 33 | """ Deletes wd (a word) from the dictionary """
| 34 | pass |
|