Created
February 20, 2016 02:27
-
-
Save msszczep/5d15b2ad8efa4faebdca to your computer and use it in GitHub Desktop.
What are the most frequently used letters in English?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(->> (slurp "ni2.txt") | |
clojure.string/split-lines | |
(map clojure.string/lower-case) | |
(map #(map char %)) | |
flatten | |
frequencies | |
(map #(vector (key %) | |
(read-string | |
(format "%.2f" (* 100 (/ (val %) 2251877.0)))))) | |
(sort-by last) | |
reverse) | |
;; ([\e 10.43] [\i 8.91] [\a 8.83] [\o 7.57] [\r 7.13] [\n 7.03] | |
;; [\t 6.78] [\s 6.18] [\l 5.78] [\c 4.59] [\u 3.87] [\p 3.47] | |
;; [\m 3.13] [\d 3.02] [\h 2.85] [\y 2.29] [\g 2.09] [\b 1.79] | |
;; [\f 1.07] [\v 0.89] [\k 0.71] [\w 0.61] [\z 0.37] [\x 0.31] [\q 0.17] [\j 0.14]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment