Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Fancy Spell-Checker")
- new = input("File to check: ")
- correct = input("File with known words [enter for default]: ")
- newfile = open(new, 'r')
- lines = newfile.readlines()
- nlines = []
- for line in lines:
- l = line[:-1].split(" ")
- nlines.append(l)
- print(nlines)
- correctfile = open(correct, 'r')
- cw = correctfile.readlines()
- allcorrectwords = []
- for w in cw:
- allcorrectwords.append(w[:-1].lower())
- print(allcorrectwords)
- for line in nlines:
- for i in range(len(line)):
- if i == len(line) - 1:
- if line[i][:-1] not in allcorrectwords:
- print(line[i])
- else:
- if line[i].lower() not in allcorrectwords:
- print(line[i])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement