import speling # Solution 1: (the evil one with large assumptions) speling.read_dictionary('dict.txt') speling.check_file('input.txt') # Solution 2: (assuming check_file doesn't really do what I want) speling.read_dictionary('dict.txt') word_list = speling.tokenize_text(speling.read_file('input.txt')).sort() seen = {} for word in word_list: if not speling.check_word(word) and not word in seen: print word, '('+str(word_list.count(word))+')' seen[word] = 1