On Friday, December 5, 2014 9:57:28 AM UTC-5, Michiaki Ariga wrote: > > I found there are no method such as sort_by() after v0.3. > But I want to count word frequency with Dict() and sort by its value to > find frequent word. > So, how can I sort Dict efficiently? >
You may want to use a different data structure. For example, you can store word frequencies in a PriorityQueue and then pull out the most frequent word with peek or dequeue. See: http://julia.readthedocs.org/en/latest/stdlib/collections/ (A PriorityQueue lets you quickly fetch the smallest value, whereas you want the largest frequency, but you can work around this by just storing frequency * -1.) If you need all of the values in order, you can instead use an OrderedDict from https://github.com/JuliaLang/DataStructures.jl