We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Error working with RiTa
Page Index Toggle Pages: 1
Error working with RiTa (Read 1165 times)
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
Re: Error working with RiTa
Reply #1 - Mar 14th, 2010, 12:35am
 
Don't swap out, import both of them.
(generic advice, as I don't know the library... but it never (rarely) hurt to put several imports.)
Re: Error working with RiTa
Reply #2 - Mar 15th, 2010, 3:48pm
 

When I leave them both there I get the error:

Cannot find a class or type named "RiText"


which is the same error I get when I only import rita.wordnet.*

going to e-mail rednoise.org and see if he can help.


Re: Error working with RiTa
Reply #3 - Mar 16th, 2010, 1:47pm
 
I discovered my problem I made a mistake in downloading ritaWN at rednoise dot org
instead of downloading the whole package at the index page.
Page Index Toggle Pages: 1