Wolfram Archive
Wolfram Programming Lab is a legacy product.
All the same functionality and features, including access to Programming Lab Explorations, are available with Wolfram|One.
Start programming now. »

Wikipedia Word Clouds

Make word cloud graphics from Wikipedia articles.

Run the code to get the text of a Wikipedia article. Try other topics, like airplane or tom_hanks:

Note: the code will return Missing[NotAvailable] if theres no such Wikipedia entry.

SHOW/HIDE DETAILS

This gets the text of the Wikipedia article on frogs and gives it the name text. The text is very long, so the code is followed with a semicolon (;), which keeps it from printing the text:

text = WikipediaData["frog"];

Use StringTake to see the first 1,000 characters of the text:

StringTake[text, 1000]

HIDE DETAILS
text = WikipediaData["frog"]; StringTake[text, 1000]

Make a word cloud from the text:

Note: run the code in the previous step first to define text.

WordCloud[text]

Get rid of unimportant words:

SHOW/HIDE DETAILS

The and and are the most common words in this text, but not the most important:

WordCloud[text]

Remove the unimportant words from the text with DeleteStopwords:

WordCloud[DeleteStopwords[text]]

HIDE DETAILS
WordCloud[DeleteStopwords[text]]

Treat uppercase and lowercase words the same:

SHOW/HIDE DETAILS

ToLowerCase makes text all lowercase:

ToLowerCase["The Cat in the Hat"]

Before making the word cloud, make the text lowercase so that, for example, Frog and frog are considered the same:

WordCloud[ToLowerCase[DeleteStopwords[text]]]

HIDE DETAILS
WordCloud[ToLowerCase[DeleteStopwords[text]]]

Share ItMake a Wikipedia word cloud website:

SHOW/HIDE DETAILS

Deploy a form that asks for a topic and gives a word cloud for the Wikipedia article on that topic:

CloudDeploy[FormFunction[{"topic" -> "String"}, WordCloud[ToLowerCase[DeleteStopwords[WikipediaData[#topic]]]] &, "PNG"], "Permissions" -> "Public" ]

Click on the link in the output to visit the site.

Tell the world about your creation by sharing the link via email, tweet, or other message.

HIDE DETAILS
CloudDeploy[FormFunction[{"topic" -> "String"}, WordCloud[ToLowerCase[DeleteStopwords[WikipediaData[#topic]]]] &, "PNG"], "Permissions" -> "Public" ]