3

I am new to Open NLP and need some help in extracting noun phrases using it. I have generated a tree structure which contains the pos tags with the text. But from the tree structure I am not able to extract the noun phrases. Here is the code I am 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 it does not return anything. How can I use p.show() to extract the noun phrases or is there any other way to get them from the tree structure?

Please help me on this.

Thanks in Advance

Gouse.

Perception
  • 79,279
  • 19
  • 185
  • 195
user2024234
  • 217
  • 1
  • 4
  • 8

0 Answers0