'Read dictionary words'

def read(self):

    paths = []
    words = u'/usr/share/dict/words'
    cracklib = u'/usr/share/dict/cracklib-small'
    propernames = u'/usr/share/dict/propernames'
    cfg = gitcfg.current()
    cfg_dictionary = cfg.get(u'cola.dictionary', None)
    if os.path.exists(cracklib):
        paths.append((cracklib, True))
    else:
        paths.append((words, True))
    if os.path.exists(propernames):
        paths.append((propernames, False))
    if (cfg_dictionary and os.path.exists(cfg_dictionary)):
        paths.append((cfg_dictionary, False))
    for (path, title) in paths:
        try:
            with open(path, u'r') as f:
                for word in f:
                    (yield word.rstrip())
                    if title:
                        (yield word.rstrip().title())
        except IOError:
            pass
    raise StopIteration
