(no title)
gwu78 | 8 years ago
A 4
B 5
B 8
C 9
A 6
How to solve with only a dict?Regarding the 1gram file at https://storage.googleapis.com/books/ngrams/books/googlebook...
This is the result I got
3| 1742563279
using q)\ts d:(!/)(" II";"\t")0:`:1gram
q)\ts 1#desc sum each group d
1897 134218176
371 238872864
or k)\ts d:(!/)(" II";"\t")0:`:1gram
k)\ts desc:{$[99h=@x;(!x)[i]!r i:>r:. x;0h>@x;'`rank;x@>x]}
k)\ts 1#desc (sum'=:d)
1897 134218176
0 3152
372 238872864
No doubt I must be doing some things wrong.
qesa|8 years ago
With the reverse thrown in to switch the key/value around we get the correct answer
or Works the same for the simple example