Making word cloud reproducible in local copy.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-14 20:27:26 -05:00
parent 216832c3e2
commit d61490e96c
3 changed files with 8 additions and 5 deletions

View File

@ -2,6 +2,7 @@ accessing
externalWordCloud externalWordCloud
| text outputFile | | text outputFile |
self writeWordsFile.
outputFile := (self folder / 'nube.png') fullName. outputFile := (self folder / 'nube.png') fullName.
text := (self folder / 'words', 'txt') fullName. text := (self folder / 'words', 'txt') fullName.
OSSUnixSubprocess new OSSUnixSubprocess new
@ -13,8 +14,8 @@ externalWordCloud
'--height' . '357' . '--height' . '357' .
'--background' . 'white' . '--background' . 'white' .
'--mode' . 'RGBA' . '--mode' . 'RGBA' .
'--stopwords' . '../commons/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;
redirectStderr; redirectStderr;

View File

@ -2,5 +2,5 @@ accessing
tweets tweets
self messages ifNil: [ ^ nil ]. self messages ifNil: [ ^ nil ].
^ TweetsCollection new ^ TweetsCollection new
messages: (self messages messages select: [ :each | each authorId = self id ]); messages: (self messages messages select: [ :each | each authorId = self id ]);
yourself yourself

View File

@ -1,6 +1,6 @@
accessing accessing
writeWordsFile writeWordsFile
"TO DO: Debug Tweet words to work better with Urls"
| rawTweets rawWords collectionsWords count | | rawTweets rawWords collectionsWords count |
self messages ifNil: [ ^ self ]. self messages ifNil: [ ^ self ].
rawTweets := self tweets messages. rawTweets := self tweets messages.
@ -9,7 +9,9 @@ writeWordsFile
collectionsWords := ((rawTweets select: collectionsWords := ((rawTweets select:
[ :tweet | tweet authorId = self id ]) [ :tweet | tweet authorId = self id ])
collect: [ :tweet | (tweet words collect: [ :tweet | (tweet words
reject: [ :w | w includesSubstring: self class nitterProvider ]) ]). reject: [ :w |
w includesSubstring:
((self class nitterProvider asUrl host copyWithoutAll: '.'))]) ]).
collectionsWords do: [ :word | rawWords addAll: word ]. collectionsWords do: [ :word | rawWords addAll: word ].
rawWords := ' ' join:rawWords. rawWords := ' ' join:rawWords.