Fix the typo "frequences" to frequencies.

This commit is contained in:
2023-10-12 22:00:01 +03:00
parent 4d7e9da1d1
commit 476a24c900
5 changed files with 26 additions and 26 deletions
@@ -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