how to use getWords() and obtain word weight in Processing

edited February 2014 in Library Questions

I use an example WebPage.pde from WordCram. Now I want to get the Words that WordCram is drawing and the weight of each words. How can I use getWrods() . Thank you very much.

/*
This sketch shows how to make a WordCram from any webpage.
It uses the WordCram blog, and was used to make the image in
the javadocs (http://wordcram.googlecode.com/svn/javadoc/index.html).

Minya Nouvelle font available at http://www.1001fonts.com/font_details.html?font_id=59
 */

import wordcram.*;

size(800, 400);
colorMode(HSB);
background(255);

new WordCram(this)
  .fromWebPage("http://wordcram.org")
  .withFont(createFont("../../MINYN___.TTF", 1))
  .withColorer(Colorers.twoHuesRandomSatsOnWhite(this))
  .sizedByWeight(7, 100)
  .maxNumberOfWordsToDraw(50)
  .drawAll();
Tagged:

Answers

  • Hi, Were you able to solve this problem? Well, I don't have the same problem but something similar.. Maybe you have already figured it out? So I was trying to make multiple text clouds in the same window.. Would you have any idea how we can do that with wordcram lib?

  • import wordcram.*;

    Is that a JavaScript library too??? :-/

  • "Is that a JavaScript library too???"
    Why are you talking about JavaScript? It isn't mentioned here.

    winston, assign the WordCram object to a variable of same type, and call getWords() on this object:

    WordCram wc = new WordCram(this).f... // etc.
    String[] words = wc.getWords();
    

    (from reading the API, untested)

Sign In or Register to comment.