diff --git a/Socialmetrica.package/NitterUser.class/instance/externalWordCloud.st b/Socialmetrica.package/NitterUser.class/instance/externalWordCloud.st index 988b988..58841cb 100644 --- a/Socialmetrica.package/NitterUser.class/instance/externalWordCloud.st +++ b/Socialmetrica.package/NitterUser.class/instance/externalWordCloud.st @@ -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; diff --git a/Socialmetrica.package/NitterUser.class/instance/wordsFile.st b/Socialmetrica.package/NitterUser.class/instance/wordsFile.st new file mode 100644 index 0000000..25c195f --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/wordsFile.st @@ -0,0 +1,8 @@ +accessing +wordsFile + + | file | + file := (FileLocator userData / 'Socialmetrica' / self userName / self userName, 'words', 'txt'). + file exists + ifFalse: [ ^ self writeWordsFile]. + ^ file \ No newline at end of file diff --git a/Socialmetrica.package/NitterUser.class/instance/writeWordsFile.st b/Socialmetrica.package/NitterUser.class/instance/writeWordsFile.st index 36a422c..7b32d4e 100644 --- a/Socialmetrica.package/NitterUser.class/instance/writeWordsFile.st +++ b/Socialmetrica.package/NitterUser.class/instance/writeWordsFile.st @@ -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. \ No newline at end of file + + 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. \ No newline at end of file