Stever1975
YaBB Newbies
Offline
Posts: 8
Error working with RiTa
Mar 13th , 2010, 3:32pm
I've installed RiTa and the following example works fine Forum won't let me post the link to the examples that work. Here's the code to one of them: import rita.wordnet.*; RiWordnet wordnet; PFont font1, font2; String word, hypos[]; void setup() { size(300, 300); font1 = loadFont("Arial-Black-12.vlw"); font2 = loadFont("Ziggurat32.vlw"); wordnet = new RiWordnet(this); } void draw() { background(40); // get synonyms every 100 frames if (frameCount%100 == 1) { String[] tmp = null; while (tmp == null) { word = wordnet.getRandomWord("n"); tmp = wordnet.getAllSynonyms(word, "n", 15); } Arrays.sort(tmp); hypos = tmp; } textFont(font2); // draw query word text(word, width-textWidth(word)-30, 40); int yPos=60; // draw the synonyms textFont(font1); for (int i = 0; i < hypos.length; i++) text(hypos[i], 30, yPos += 13); } When I tried to run the code from this example import rita.*; // Kafka + Wittgenstein /* * @desc Uses a Markov model to produce text. */ int MAX_LINE_LENGTH = 60; RiText rts[]; RiMarkov markov; void setup() { size(380, 500); // a little info msg new RiText(this, "click to (re)generate!", 135, height/2); RiText.setDefaultAlignment(LEFT); // create a new markov model w' n=3 markov = new RiMarkov(this, 3); // load 2 files into the model markov.loadFile("wittgenstein.txt"); markov.loadFile("kafka.txt"); } void draw() { background(80); } // generate on mouse click void mouseClicked() { RiText.deleteAll(); // clean-up old data // generate 10 (linked) sentences String[] lines = markov.generateSentences(10); // lay out the return text starting at x=20 y=50) rts = RiText.createLines(this, lines, 20, 50, MAX_LINE_LENGTH); } I get the following error: "Note that release 1.0, libraries must be installed in a folder named 'libraries' inside the 'sketchbook' folder." The first obvious difference I see is the working examples import: import rita.wordnet.*; and the example that keeps bugging out imports: import rita.*; when I swap out "import rita.*;" with "import rita.wordnet.*;" I get the error "cannot find class or type named RiText" Not too familiar with java. But I'm guessing it has something to do with the namespace. Any help would be greatly appreciated. Steve