projects
/
cipher-training.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Done Cadenus ciphers, but not automated breaking
[cipher-training.git]
/
norms.py
diff --git
a/norms.py
b/norms.py
index b8e4bf1ef82c8b8ea6f85c0e3c3597d90b7d9b8b..66452940c376658e446bb704c7198ee1ace2be22 100644
(file)
--- a/
norms.py
+++ b/
norms.py
@@
-13,7
+13,7
@@
def normalise(frequencies):
>>> sorted(normalise({1: 1, 2: 2, 3: 1}).items())
[(1, 0.25), (2, 0.5), (3, 0.25)]
"""
>>> sorted(normalise({1: 1, 2: 2, 3: 1}).items())
[(1, 0.25), (2, 0.5), (3, 0.25)]
"""
- length = sum(
[f for f in frequencies.values()]
)
+ length = sum(
f for f in frequencies.values()
)
return collections.defaultdict(int, ((k, v / length)
for (k, v) in frequencies.items()))
return collections.defaultdict(int, ((k, v / length)
for (k, v) in frequencies.items()))