3 from szyfrow
.support
.utilities
import sanitise
5 corpora
= ['shakespeare.txt', 'sherlock-holmes.txt', 'war-and-peace.txt']
6 counts
= collections
.Counter()
9 text
= sanitise(open('szyfrow/support/' + corpus
, 'r').read())
12 sorted_letters
= sorted(counts
, key
=counts
.get
, reverse
=True)
14 with
open('szyfrow/support/count_1l.txt', 'w') as f
:
15 for l
in sorted_letters
:
16 f
.write("{0}\t{1}\n".format(l
, counts
[l
]))