Improving nitter user words file and external word cloud.

This commit is contained in:
ruidajo 2022-04-05 17:37:42 -05:00
parent 20f12bfcfc
commit 311c422216
3 changed files with 25 additions and 8 deletions

View File

@ -3,7 +3,7 @@ externalWordCloud
| text outputFile |
outputFile := (self folder / 'nube.png')fullName.
text := (self folder / 'texto.txt')fullName.
text := (self folder / self userName, 'words', 'txt')fullName.
OSSUnixSubprocess new
command: 'wordcloud_cli';
arguments: { '--text' . text .
@ -13,7 +13,7 @@ externalWordCloud
'--height' . '357' .
'--background' . 'white' .
'--mode' . 'RGBA' .
'--stopwords' . 'stopwords-es.txt' .
'--stopwords' . '../commons/stopwords-es.txt' .
'--mask' . '../commons/nube-mascara.jpg'};
workingDirectory: self folder fullName;
redirectStdout;

View File

@ -0,0 +1,8 @@
accessing
wordsFile
| file |
file := (FileLocator userData / 'Socialmetrica' / self userName / self userName, 'words', 'txt').
file exists
ifFalse: [ ^ self writeWordsFile].
^ file

View File

@ -1,10 +1,19 @@
accessing
writeWordsFile
| rawTweets output |
| rawTweets rawWords collectionsWords count |
self tweets ifNil: [ ^ self ].
rawTweets := self tweets tweets.
output := '' writeStream.
rawTweets do: [ :current |
output addAll: current words.
].
^ MarkupFile exportAsFileOn: FileLocator "usersStorage" containing: output.
rawWords := OrderedCollection new.
collectionsWords := ((rawTweets select:
[ :tweet | tweet user userName = 'FranciaMarquezM' ])
collect: [ :tweet | (tweet words
reject: [ :w | w includesSubstring: 'nitter42lfr' ]) ]).
count := 1.
collectionsWords size timesRepeat: [
rawWords addAll: (collectionsWords at:count).
count := count + 1.].
rawWords := ' ' join:rawWords.
^ MarkupFile exportAsFileOn: (FileLocator userData / 'Socialmetrica' / self userName / self userName, 'words', 'txt') containing: rawWords.