projects
/
cipher-training.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed the merge conflict
[cipher-training.git]
/
lettercount.py
diff --git
a/lettercount.py
b/lettercount.py
index 18f75c48db4d8f141f19a645267a86f58b704d5e..956eca1a5b2ba469d66c80612446726cdf8307d4 100644
(file)
--- a/
lettercount.py
+++ b/
lettercount.py
@@
-8,8
+8,6
@@
for corpus in corpora:
text = sanitise(open(corpus).read())
counts.update(text)
text = sanitise(open(corpus).read())
counts.update(text)
-sorted_letters = sorted(counts, key=counts.get, reverse=True)
-
with open('count_1l.txt', 'w') as f:
with open('count_1l.txt', 'w') as f:
- for l
in sorted_letters
:
- f.write("{}\t{}\n".format(l, c
ounts[l]
))
+ for l
, c in counts.most_common()
:
+ f.write("{}\t{}\n".format(l, c))