How to retrieve Verb object object using nlp java

How to extract SVO using NLP in java, I am new to nlp.i, currently using opennlp. but how to do in java with perticular in a java sentence.

LexicalizedParser lp = **new LexicalizedParser("englishPCFG.ser.gz");**
String[] sent = { "This", "is", "an", "easy", "sentence", "." };
Tree parse = (Tree) lp.apply(Arrays.asList(sent));
parse.pennPrint();
System.out.println();
TreePrint tp = new TreePrint("penn,typedDependenciesCollapsed");
tp.print(parse);

receiving a compilation error with the new LexicalizedParser ("englishPCFG.ser.gz"); ** LexicalizedParser (String) constructor is undefined

+5
source share
4 answers

It looks like you are using the new version of the Stanford NLP parser. in the new version, the constructors of this analyzer are not used to allocate memory; instead, we have specialized functions. you can use:

LexicalizedParser lp = LexicalizedParser.loadModel("englishPCFG.ser.gz");

You can use various overloads of this API.

Stanford documentation for various overloads loadModel

+2
source

Stanford, OpenNLP. , ParserDemo.java(/ ParserDemo2.java), stanford-parser , stanford-parser.jar . , -.

0

You can use Stanford CoreNLP. Check here for a "rough algorithm" how to get a predicate-object-object from a sentence.

0
source

You can use reverb. Check the answer here for "reVerb" how to extract information from a sentence

0
source

All Articles