Jason the Content Librarian / 286 posts / categories / 175 comments / feed / comments feed

Calicon09 Word Cloud

I created a word cloud for the #calicon09 tweets with Wordle.

calicon09

Thanks to Yankee in Canada for the idea.

Here’s how I did it:

1. Used the twitter API to access the tweets with the #calicon09 hash tag in a json format.

2. Based on some code found around the interwebs, I put together some php for processing the json format.

<?php
$json = file_get_contents(“http://search.twitter.com/search.json?q=%23calicon09&rpp=100&page=1″, true); //getting the file content
$decode = json_decode($json, false); //getting the file content as array
foreach ( $decode->results as $results )
{
echo “{$results->text}\n”;
}
echo “<pre>”;
print_r($decode);
$count = count($decode);
print_r($count);
echo “</pre>”;
$text = $array['results']['text'];
print_r($text)
?>

<?php
$json = file_get_contents(“http://search.twitter.com/search.json?q=%23calicon09&rpp=100&page=1″, true); //getting the file content
$decode = json_decode($json, false); //getting the file content as array
foreach ( $decode->results as $results )
{
echo “{$results->text}\n”;
}
?>

Note the api for twitter only returns certain numbers of results per page. I had to run a few pages at 100 results per page to get all the tweets. I know there are ways to automate this, but it’s a little beyond me at the moment, and this was fine for this particular task.

3. Drop the text of all the tweets into a text editor.

4. Shaped the data. I removed the tag #calicon09, removed @usernames, and a few other stop words. I’m sure I could remove more, but I think the resulting cloud is nice.

5. Paste the text into Wordle’s full text form.

I’m sure people may find some problems with the way I cobbled this together. I welcome constructive comments.

No comments

Closed comments.