Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
3
Task/Letter-frequency/Crystal/letter-frequency.cr
Normal file
3
Task/Letter-frequency/Crystal/letter-frequency.cr
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
File.open("les_miserables.txt") do |f|
|
||||
pp f.each_char.select(&.letter?).tally.to_a.sort_by {|k,v| -v}
|
||||
end
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
val countLetters = fn(s) {
|
||||
for[={:}] s2 in split(replace(s, RE/\P{L}/)) {
|
||||
for[={:}] s2 in split(replace(s, by=RE/\P{L}/)) {
|
||||
_for[s2; 0] += 1
|
||||
}
|
||||
}
|
||||
|
||||
val counts = countLetters(readfile("./fuzz.txt"))
|
||||
writeln join("\n", map(fn(k) { "{{k}}: {{counts[k]}}" }, keys(counts)))
|
||||
writeln join(map(keys(counts), by=fn(k) { "{{k}}: {{counts[k]}}" }), by="\n")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue