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 › Problem with RiTA library
Page Index Toggle Pages: 1
Problem with RiTA library (Read 2801 times)
Problem with RiTA library
Jun 5th, 2010, 1:56am
 
Hi everyone.
I'm trying to work with RiTA library, API being Netbeans, for some text analysis. I read through of how to use it over the net and got some information in this regard.

I'm creating a new object of RiWordnet as:
RiWordnet obj = new RiWordnet(null);

then this object I'm using in calling the method getAllSynonyms() of RiTA library as:
syn = ri.getAllSynonyms("text","n",15);
where syn is a String[] type.

But the thing is it's not returning the required result. The output shows as something:: [Ljava.lang.String;@587c94

I partly understand that the last numbers i.e 587c95 would be the index of the word in RiTA database, but not the whole error.

Can someone who has worked in RiTA throw some light in this problem.

Thanks in advance.
Re: Problem with RiTA library
Reply #1 - Jun 5th, 2010, 2:20am
 
[Ljava.lang.String
The [ means you have an array.
So the function returns a Striing[] which makes sense ("get all").
So you have to iterate on the array to print each element (or just use PApplet.println which does that for you).
Re: Problem with RiTA library
Reply #2 - Jun 5th, 2010, 4:21am
 
Thanks PhiLho for replying.
Thanks a ton man for the answer. It really helped. Thanks a lot man.
Re: Problem with RiTA library
Reply #3 - Jun 13th, 2010, 1:20pm
 
Hi,

I work on a system to analyze some tweets with RiTa. She's seems to don't like the "#" char. I'd tried to make a filter with a string[] to exclude the # in tweets. That's don't work now. If anybody have a tips for me it will be cool for my poor brain.

This is the part of code what doesn't worked. I'm a P5 newbie with some problems about boolean object. I'm waiting for the Handbook for processing...

Thanks

Code:

myTwitter = new Twitter ("twitterID", "password");
try {

Query query = new Query("#zeitlinie");
query.setRpp(40);
QueryResult result = myTwitter.search(query);

ArrayList tweets = (ArrayList) result.getTweets();
for (int i = 0; i < tweets.size(); i++) {
Tweet t = (Tweet) tweets.get(i);

String user = t.getFromUser();
String msg = t.getText();
Date d = t.getCreatedAt();

String[] words = RiTa.tokenize(msg);
int L1 = msg.length();
boolean a = true;
for (int n = 0; n < L1; n++) {
if (a == true) {
words[n]="#";
subset(words, n, 1);
println(words);
}
}

Re: Problem with RiTA library
Reply #4 - Jun 14th, 2010, 1:18am
 
Your problem isn't really related to the original one (despite the common use of RiTa)...

Anyway, you can do that in a simple way:
Code:
msg = msg.replaceAll("#", "");
String[] words = RiTa.tokenize(msg);
Re: Problem with RiTA library
Reply #5 - Jun 17th, 2010, 4:06am
 
Hi PhiLo,

I try your tips and that's worked perfectly. Obviously, I didn't read the documentation of RiTa enough.

I thank you much for your invaluable assistance...

This is the webpage of our project www.zeitlinie.net that interest you to look at.
Page Index Toggle Pages: 1