4
$\begingroup$

Is there a way to make a Mathematica word cloud of Twitter search data?

Example: Suppose you search twitter for "#Mathematica". This will bring up a bunch of tweets with other words than just "#Mathematica". It would be nice to make a word cloud of all these words to see what related concepts people are tweeting about alongside "#Mathematica". Is this possible?

$\endgroup$
  • $\begingroup$ Unfortunately, last I checked the ServiceConnect["Twitter"] functionality had not been updated to handle 280 character tweets, which made it difficult to use... $\endgroup$ – user6014 Apr 6 '18 at 4:23
3
$\begingroup$

Yeah, sure.

twitter = ServiceConnect["Twitter", "New"];
result = twitter["TweetSearch", "Query" -> "#Mathematica", 
   MaxItems -> 50];
WordCloud@Flatten[Normal[StringSplit[#["Text"]] & /@ result]]

enter image description here

$\endgroup$
  • $\begingroup$ This doesn't work with Mathematica Online (mathematica.wolframcloud.com); should it? $\endgroup$ – George Apr 6 '18 at 4:25
  • $\begingroup$ Sorry, George, I don't have access to the online version. Try to run the code line-by-line. Where does a problem occur? I guess it is at the first line because you cannot login to the Twitter (API works only after this). $\endgroup$ – Ihor Apr 6 '18 at 4:37
  • $\begingroup$ Correct. ServiceConnect["Twitter", "New"] returns ServiceObject["TwitterNotConnected"]. $\endgroup$ – George Apr 6 '18 at 4:40
  • $\begingroup$ Then establishing a connection to Twitter in Mathematica Online is a separate problem, which I cannot help you with. Good luck! $\endgroup$ – Ihor Apr 6 '18 at 4:47
  • $\begingroup$ See for a new question: mathematica.stackexchange.com/questions/170552/… $\endgroup$ – George Apr 6 '18 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.