#!/bin/env python import time import sys # This is where the 'words' is. WORDS = '/usr/share/dict/words' # Make a list WL = file(WORDS).read().lower().split() # text for the spell check text = file(sys.argv[1]).read() twords = text.split() nowords = [] start = time.time() print 'start %f' % start for w in twords: w = w.strip('.,;').lower() #if w not in WL and w not in nowords: if w not in nowords and w not in WL: nowords.append(w) stop = time.time() print 'stop %f' % stop print 'time %f' % (stop - start) print 'not in words %d' % len(nowords) # uncomment hereafter for result comparison #nowords.sort() #for w in nowords: # print w