Add a function to convert a count map to a reversed map.
This commit is contained in:
@@ -11,6 +11,16 @@
|
||||
(inc (get acc val 0))))
|
||||
{} text))
|
||||
|
||||
(defn reverse-count-characters
|
||||
"Convert a map of pairs to a map where the characters grouped by the count and a count is the key."
|
||||
[count-map]
|
||||
(reduce
|
||||
(fn [acc [symbol count]]
|
||||
(->> (conj (get acc count []) symbol)
|
||||
(into [])
|
||||
(assoc acc count)))
|
||||
{} count-map))
|
||||
|
||||
(defn chi-squared-letter-statistic
|
||||
"To calculate the frequency distribution of a letter."
|
||||
[letter-count letter-frequence length-text]
|
||||
|
||||
Reference in New Issue
Block a user