Advertisement
biswasrohit20

fl

Jun 17th, 2021
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. print("Fancy Spell-Checker")
  2. new = input("File to check: ")
  3. correct = input("File with known words [enter for default]: ")
  4.  
  5.  
  6. newfile = open(new, 'r')
  7. lines = newfile.readlines()
  8. nlines = []
  9. for line in lines:
  10. l = line[:-1].split(" ")
  11. nlines.append(l)
  12. print(nlines)
  13.  
  14. correctfile = open(correct, 'r')
  15. cw = correctfile.readlines()
  16. allcorrectwords = []
  17. for w in cw:
  18. allcorrectwords.append(w[:-1].lower())
  19. print(allcorrectwords)
  20.  
  21.  
  22. for line in nlines:
  23. for i in range(len(line)):
  24. if i == len(line) - 1:
  25. if line[i][:-1] not in allcorrectwords:
  26. print(line[i])
  27. else:
  28. if line[i].lower() not in allcorrectwords:
  29. print(line[i])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement