Socialmetrica/Socialmetrica.package/TweetsCollection.class/instance/asMessagesUserNamesSortedByOccurrences.st

9 lines
390 B
Smalltalk
Raw Normal View History

accessing
asMessagesUserNamesSortedByOccurrences
| response messagesOccurrences |
messagesOccurrences := (self collect: [ :tweet | tweet user userName ]) asBag contents asDictionary.
response := OrderedDictionary new.
(messagesOccurrences associations asSortedCollection: [:x :y | x value > y value])
collect: [:assoc | response at: assoc key put:assoc value].
^ response