Socialmetrica/Socialmetrica.package/NitterUser.class/instance/quotesSortedByOccurrences.st

9 lines
429 B
Smalltalk

accessing
quotesSortedByOccurrences
| response quotesUserOccurrences |
quotesUserOccurrences := (self quotes messages collect: [ :tweet | ((tweet metadata at: 'quote') splitOn: '/') first ]) asBag contents asDictionary.
response := OrderedDictionary new.
(quotesUserOccurrences associations asSortedCollection: [:x :y | x value > y value])
collect: [:assoc | response at: assoc key put:assoc value].
^ response