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?

  • $\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$
    – ktm
    Commented Apr 6, 2018 at 4:23

1 Answer 1


Yeah, sure.

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

enter image description here

  • $\begingroup$ This doesn't work with Mathematica Online (mathematica.wolframcloud.com); should it? $\endgroup$
    – George
    Commented Apr 6, 2018 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
    Commented Apr 6, 2018 at 4:37
  • $\begingroup$ Correct. ServiceConnect["Twitter", "New"] returns ServiceObject["TwitterNotConnected"]. $\endgroup$
    – George
    Commented Apr 6, 2018 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
    Commented Apr 6, 2018 at 4:47
  • $\begingroup$ See for a new question: mathematica.stackexchange.com/questions/170552/… $\endgroup$
    – George
    Commented Apr 6, 2018 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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