Alex Rivera | Logout

Extract Nouns from Text (Java)

Asked 2009-12-11T17:40:33.140
13

Does anyone know the easiest way to extract only nouns from a body of text?

I've heard about the TreeTagger tool and I tried giving it a shot but couldn't get it to work for some reason.

Any suggestions?

Thanks Phil

EDIT:

 import org.annolab.tt4j.*; 
TreeTaggerWrapper tt = new TreeTaggerWrapper(); 

try { tt.setModel("/Nouns/english.par"); 

tt.setHandler(new TokenHandler() { 
     void token(String token, String pos, String lemma) {    
     System.out.println(token+"\t"+pos+"\t"+lemma); } }); 
     tt.process(words); // words = list of words 

     } finally { tt.destroy(); 
} 

That is my code, English is the language. I was getting the error : The type new TokenHandler(){} must implement the inherited abstract method TokenHandler.token. Am I doing something wrong?

Edit
Report

2 Answers

1

Check out LingPipe. This can supposedly pick out named entities from English text. But I must confess that NLP isn't my area of expertise.

answered 2009-12-11T17:48:17.043
0

Have a look at the WordNet database. This lexical database. You could try matching each word against it and check if it's a noun.

I doubt that you will have 100% precision, though; the database doesn't have a match for every possible word in the english language, but at least it's a start.

answered 2009-12-11T17:47:39.307

Your Answer