Advertisement
Guest User

Untitled

a guest
Feb 13th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. #! /usr/bin/env python                                                                                                                                                                              
  2. import string
  3.  
  4. puncts = string.punctuation.translate(None, "'")
  5.  
  6. def clean(word):
  7.     return word.lower().translate(None, puncts)
  8.  
  9. if __name__ == '__main__':
  10.     import sys
  11.     f = open(sys.argv[1])
  12.     text = ''.join(f.readlines())
  13.  
  14.     # read the dictionary
  15.     fd = open('/usr/share/dict/words')
  16.     d = set(w.strip() for w in fd.readlines())
  17.     fd.close()
  18.  
  19.     for word in text.split():
  20.         if clean(word) not in d: print word
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement