Fix the typo "frequences" to frequencies.
This commit is contained in:
@@ -21,16 +21,16 @@
|
||||
|
||||
(defn chi-squared-statistic
|
||||
"To calculate the frequency distribution of a language. More detail about the algorithm here: http://practicalcryptography.com/cryptanalysis/text-characterisation/chi-squared-statistic/"
|
||||
[text letter-frequences]
|
||||
[text letter-frequencies]
|
||||
(let [length-text (count text)
|
||||
letter-counts (count-characters (cs/lower-case text))]
|
||||
;letter-counts
|
||||
(reduce
|
||||
(fn [acc [char count]]
|
||||
(+ acc
|
||||
(if (contains? letter-frequences char)
|
||||
(if (contains? letter-frequencies char)
|
||||
(chi-squared-letter-statistic count
|
||||
(get letter-frequences char)
|
||||
(get letter-frequencies char)
|
||||
length-text)
|
||||
0)))
|
||||
0
|
||||
|
||||
Reference in New Issue
Block a user