텍스트 파일을 읽고 맞춤법이 잘못된 단어 사전을 만드는 함수를 만들어야합니다. 이 내가 지금까지어떻게 내 맞춤법 검사 코드를 완료 할 수 있습니까?
def spellCheck(textFileName):
file=open("words.txt","r")
wordsList = file.read()
print wordsList
file.close()
file=open(textFileName, "r")
wordsToCheck = file.read()
print wordsToCheck
file.close()
# The next line creates the dictionary
# This dictionary will have the word that has been spelt wrong as the key and the number of times it has been spelt wrong as the value
spellingErrors = dict= {'words', wordsToCheck}
가진 것을 내가 필요로 :
# Loop through the wordsToCheck list
# Change the current word into lower case
# If the current word does not exist in the wordsList then
# Check if the word already exists in the spellingErrors dictionary
# If it does not exist than add it to the dictionary with the initial value of 1.
# If it does exist in the dictionary then increase the value by 1
# Return the dictionary
그래서,에 대한 실제 알고리즘, 당신은 지금까지 무엇을 시도 했습니까? – learner
너무 현지화되었습니다. 다시. http://stackoverflow.com/questions/13573552/can-anyone-help-me-with-my-spell-check-code – Yandros