WordCram’s moving to GitHub

I started moving WordCram on to GitHub, and most things are in place, like the issues list and the wiki. I still need to copy over the downloads. Got the downloads, too! (Only 0.5.0 for now – the older ones are still at googlecode, but I’ll probably copy them too, eventually.)

Let me know if I missed anything!

Posted in Uncategorized | Leave a comment

WordCram Release 0.5.0

Today I learned that WordCram 0.4.1 doesn’t work with Processing 1.5, and the root of the problem is the way it renders word shapes. Then I found that the same change that enables PDF rendering enables Processing 1.5 support.

So I could bug-fix the Processing 1.5 support, or throw in PDF rendering and call it a release. Changing the way WordCram renders word shapes is pretty core, so I chose the release. And as a bonus, PDF support is official!

And that’s how WordCram 0.5.0 found its way out into the world this afternoon. The big news is PDFs, but you can also control the padding between your words. Download it now! You can thank me later. Send me a WordCrammed PDF.

Next up: replacing the text parsing code with cue.language.

Posted in release, wordcram | 6 Comments

New daily: WordCram to PDF

WordCram now outputs to PDF. It’ll be in the 0.5 release, but you can grab the new daily build right now (zip or tar) and try it out. The only new code you’ll need is normal Processing PDF stuff, all the WordCram code stays the same. Just import processing.pdf.*, and use size(width, height, PDF, "path/to/output.pdf").

Here’s an example, a PDF word cloud from the Wikipedia page on PDF. Here’s the code to produce it:

import processing.pdf.*;
import wordcram.*;

void setup() {
  size(700, 700, PDF, "wordcram.pdf");
  
  background(255);
  
  new WordCram(this)
    .fromWebPage("http://en.wikipedia.org/wiki/Portable_Document_Format")
    .withColors(#000000, #777777, #ff0000)
    .withFonts("LiberationSans")
    .sizedByWeight(1, 200)
    .withWordPadding(1)
    .angledAt(0)
    .withPlacer(new WordPlacer() {
      public PVector place(Word w, int r, int c, int ww, int wh, int fw, int fh) {
        float xScatter = (1-w.weight);
        float x = map(random(-xScatter, xScatter), -1, 1, 30, fw-ww-30);
        float y = (1-pow(w.weight, 0.25)) * (fh - wh) + 30;
        return new PVector(x, y);
      }
    })
    .drawAll();
}

I’m pretty excited about this. PDF output was one of the first features asked for, and it’s been a goal of mine to finish it. But more importantly, we can now print some really nice, high-res word clouds!

Posted in examples, wordcram | 6 Comments

BarCamp Boston 6 Slides Up

Here they are!

Posted in wordcram | Leave a comment

See You at Barcamp Boston 6

http://www.barcampboston.org/

import wordcram.*;

void setup() {
  size(900, 500);
  colorMode(HSB);
}

void draw() {
  background(68);
  color red = color(0, 255, 255);
  color mustard = color(30, 255, 255);
  
  new WordCram(this)
    .fromWebPage("http://en.wikipedia.org/wiki/Barcamp")
    .withColors(color(0, 0, 0), 
                color(0, 0, 255), 
                mustard) // red)
    .withFonts(PFont.list())
    .withAngler(moreRandomByWeight())
    .withPlacer(crazyPlacer())
    .sizedByWeight(8, 100)
    .maxNumberOfWordsToDraw(300)
    .drawAll();
}

WordAngler moreRandomByWeight() {
  return new WordAngler() {
    public float angleFor(Word w) {
      float range = (1-w.weight) * PI;
      return random(-range, range);
    }
  };
}

WordPlacer crazyPlacer() {
  return new WordPlacer() {
    public PVector place(Word w, int rank, int words, 
                        int ww, int wh, int fw, int fh) {
      float x = (fw-ww) * (1-w.weight);
      float y = random(fh-wh);
      return new PVector(x, y);
    }
  };
}

Posted in examples, wordcram | 1 Comment

WordCram Release 0.4.1

WordCram 0.4.1 is a minor bug-fix release, available in zip and tar.

Danilo Di Cuia wondered whether French accents worked in WordCram, which surprised me, because I’ve seen characters like that in WordCrams before. But as it turns out, it only worked if you pass your own array of Words: the word-counting part was removing all accented characters from the source text.

The bug’s fixed now, but for the 0.5 release, I’ll probably replace that whole part with cue.language instead. It’s a small library for natural-language tasks, written by Wordle creator Jonathan Feinberg, and it grew out of Wordle. It’s better-tested, and it handles a bunch of languages already. That part of WordCram was always pretty immature, so it’ll be nice to rely on something more battle-hardened.

 

Posted in release, wordcram | Leave a comment

WordCram Release 0.4

WordCram 0.4 is ready for consumption! Download the zip or the tar.

The high notes:

  • If you’re passing your own words, you can pre-set their color, font, size, angle, and placement: word.setColor(#f02939).setAngle(QUARTER_PI); These settings will override the WordColorer, WordAngler, etc. This should make it easier to control how specific words are drawn, but you can even use it for styling all your words.
  • If you’re not seeing as many words as you expected, you can call getSkippedWords() to see which words were skipped, and call wasSkippedBecause() on each one to see why it was skipped. If you’re troubleshooting the words that do show up, you can call getRenderedSize(), getRenderedColor(), etc, on each word. And if you want to do some interaction, getWordAt(x,y) will tell you which word is at the given [x,y] coordinates.
  • All the settings for fine-tuning a WordCram are now at your fingers. If your WordCram is too slow, too crowded, or too sparse, you can probably fix it: you can limit how many words WordCram will try to render, limit the size of the smallest word it’ll accept, and limit how many times it’ll try to place a word.
  • A bunch of new tutorial sketches will walk you through WordCram in (I hope) a sensible order. They cover all the features, both new and old.

See the Release notes, the tutorial sketches, and the javadoc for the details. If you have any questions or feedback, or just want to show off your word clouds, I’m @wordcram on twitter, and wordcram-at-gmail.

Posted in release, wordcram | Leave a comment

Golan Levin’s SubRip Processing Parser

Golan Levin just posted a Processing parser for SubRip subtitle files, and posted a demo applet that generates a tag clouds (via OpenCloud) from Star Wars.

It should be fun to try using his parser with WordCram.

Posted in related | Leave a comment

2011 State of the Union Address, WordCrammed

Twelve other runs:

The code for all of them:

import wordcram.*;
import wordcram.text.*;

void setup() {
  size(700, 500);
}

void draw() { 
  background(255);
  new WordCram(this)
    .fromTextFile("state-of-the-union.txt")
    .withColors(
      color(0), color(230, 0, 0), color(0, 0, 230))
    .withPlacer(Placers.centerClump())
    .sizedByWeight(10, 100)
    .drawAll();
  
  saveFrame("sotu-##.png");
}

Posted in examples, wordcram | 1 Comment

WordCram Interview

I just realised I never posted a link to the WordCram interview that Zoltán Varjú was kind enough to conduct!

Zoltán runs a blog called Számítógépes nyelvészet (which Google tells me is Hungarian for Computational Linguistics) where he regularly interviews people working in computational linguistics and related fields.  Impressive company for WordCram to keep. His blog is worth checking out — there are a number of English posts, and Google Translate helps with the rest, for non-Hungarian-speakers like me.

Zoltán, I’m terribly sorry for letting it slip.  Thanks again for the interview!

Posted in wordcram | Leave a comment