Creating retweets and quotes sorted by occurrences.

This commit is contained in:
ruidajo 2022-04-20 15:49:50 -05:00
parent e840f733fe
commit cde55509bf
3 changed files with 19 additions and 1 deletions

View File

@ -3,7 +3,7 @@ exportRetweetsHistogram
| retweetsOccurrences labels retweetColor diagram x retweetsHistogram |
retweetsOccurrences := (self retweets messages collect: [ :tweet | tweet user userName ]) asBag contents asDictionary.
retweetsOccurrences := self retweetsSortedByOccurrences.
retweetColor := (Color r:(217/255) g:(56/255) b: (124/255)).
x := 1 to: retweetsOccurrences size.
retweetsHistogram := RSChart new.

View File

@ -0,0 +1,9 @@
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

View File

@ -0,0 +1,9 @@
accessing
retweetsSortedByOccurrences
| response retweetsOccurrences |
retweetsOccurrences := (self retweets messages collect: [ :tweet | tweet user userName ]) asBag contents asDictionary.
response := OrderedDictionary new.
(retweetsOccurrences associations asSortedCollection: [:x :y | x value > y value])
collect: [:assoc | response at: assoc key put:assoc value].
^ response