Advertisement
Guest User

Untitled

a guest
Nov 11th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import enchant # https://pythonhosted.org/pyenchant/
  2. import re
  3.  
  4. FILENAME='file.pdf'
  5.  
  6. d = enchant.Dict("en_US")
  7. with open(FILENAME, 'rb') as f:  
  8.     menu = f.read()
  9.  
  10. m = re.sub('[^a-zA-Z]+', ' ', menu)
  11. words = filter(lambda w: len(w)>1 and d.check(w), m.split(' '))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement