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 | | text outputFile |
outputFile := (self folder / 'nube.png')fullName. outputFile := (self folder / 'nube.png')fullName.
text := (self folder / 'texto.txt')fullName. text := (self folder / self userName, 'words', 'txt')fullName.
OSSUnixSubprocess new OSSUnixSubprocess new
command: 'wordcloud_cli'; command: 'wordcloud_cli';
arguments: { '--text' . text . arguments: { '--text' . text .
@ -13,7 +13,7 @@ externalWordCloud
'--height' . '357' . '--height' . '357' .
'--background' . 'white' . '--background' . 'white' .
'--mode' . 'RGBA' . '--mode' . 'RGBA' .
'--stopwords' . 'stopwords-es.txt' . '--stopwords' . '../commons/stopwords-es.txt' .
'--mask' . '../commons/nube-mascara.jpg'}; '--mask' . '../commons/nube-mascara.jpg'};
workingDirectory: self folder fullName; workingDirectory: self folder fullName;
redirectStdout; 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 accessing
writeWordsFile writeWordsFile
| rawTweets output |
| rawTweets rawWords collectionsWords count |
self tweets ifNil: [ ^ self ]. self tweets ifNil: [ ^ self ].
rawTweets := self tweets tweets. rawTweets := self tweets tweets.
output := '' writeStream.
rawTweets do: [ :current | rawWords := OrderedCollection new.
output addAll: current words. collectionsWords := ((rawTweets select:
]. [ :tweet | tweet user userName = 'FranciaMarquezM' ])
^ MarkupFile exportAsFileOn: FileLocator "usersStorage" containing: output. 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.