Skip to content

Instantly share code, notes, and snippets.

@objectiveSee
Last active August 29, 2015 14:02
Show Gist options
  • Save objectiveSee/2b0d1866379be18a35c5 to your computer and use it in GitHub Desktop.
Save objectiveSee/2b0d1866379be18a35c5 to your computer and use it in GitHub Desktop.
Burning Man 2014 Word Cloud Generation
{
"private": "true",
"name": "burnerwords",
"version": "v0.0.1",
"dependencies": {
"underscore": ">=1.4.4",
"optimist": "~0.3.5",
"read-json" : "~0.0.0",
"word-freq" : "~0.0.8"
}
}
global._ = require('underscore');
var readJSON = require('read-json');
var request = require('request');
var WordFreq = require('word-freq');
// Burning Man API : http://playaevents.burningman.com/api/0.2/2014/event/
// Use the API (via an HTTP request) or a local file (via the ReadJSON module).
// readJSON('./events.json', function(error, manifest){
request('http://playaevents.burningman.com/api/0.2/2014/event/', function (error, response, body) {
// parse the response into JSON
var manifest = JSON.parse(body);
// build a gigantic string that is the concatenation of all event descriptions.
var bigstring = "";
_.each(manifest, function(thing) {
// console.log(thing);
bigstring += " "+thing.description.toLowerCase();
});
// here we can use the WordFreq module to generate the frequency count. However, I found that copying the bigstring and pasting it into an online word cloud generator was easier.
//var freq = WordFreq.freq(bigstring);
console.log(bigstring);
// Copy the console output (bigstring) into http://www.wordle.net/create to finish it off!!
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment