This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-04-06 09:51:00 -05:00
commit 112765cc72
5 changed files with 48 additions and 8 deletions

View File

@ -0,0 +1,5 @@
accessing
defaultConfig
self config: { 'folder' -> (FileLocator userData / 'Socialmetrica' / self userName) } asDictionary.
^ self config

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,18 @@
accessing
numberOfURLsForLoadingTweets: number
| collectionURLs count asURLs |
collectionURLs := {
self userNameLink .
(self userNameLink, ((self documentTree xPath: '//a[.="Load more"]') @ 'href') stringValue) .} asOrderedCollection.
number <= 2 ifTrue: [ ^ collectionURLs ].
count := 2.
(number-count) timesRepeat: [ | tempDoc |
tempDoc := XMLHTMLParser parse: (collectionURLs at: count) asUrl retrieveContents.
collectionURLs
add: (self userNameLink,
((tempDoc xPath: '//a[.="Load more"]') @ 'href') stringValue).
count := count+1 ].
asURLs := collectionURLs collect: [ :string | string asUrl ].
^ asURLs.

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.