# Calvin Smith # Craft 3, part uno import speling speling.LoadDic('dict.txt') # speling.SpellCheck('input.txt') # too easy to use this, so don't use this function text = open('input.txt', 'r').read() sents = [] for symbol in '\n(),-?\"\&$#@!%^*_=+/\\;:'0123456789: text = text.replace(symbol, ' ') sents = text.split('.') mispeledwords = {} for sent in sents: mispeled = CheckSent(sent) for word in mispeled: if mispeledwords.get('word', None): mispeledwords['word'] = mispeledwords['word'] + 1 else: mispeledwords['word'] = 1 keys = mispeledwords.keys() keys.sort() for key in keys: print key, '(' + str(mispeledwords[key]) + ')'