How to extract noun phrases using Open NLP

I'm new to Open NLP and need help extracting the name phrases using it. I created a tree structure that contains pos tags with text. But I can't extract nouns from the tree structure. Here is the code I'm using:

InputStream is = new FileInputStream("en-parser-chunking.bin");
ParserModel model = new ParserModel(is);
Parser parser = ParserFactory.create(model);
Parse topParses[] = ParserTool.parseLine(line, parser, 1);
    for (Parse p : topParses){
             p.show();} 

      

Here p.show()

prints the tree structure and returns nothing. How can I use p.show()

phrases to extract nouns or is there any other way to get them from a tree structure?

Please help me with this.

Thanks in Advance

Gouse.

+3


source to share





All Articles