Hola! there are two ways I have approached this with OpenNLP, others may provide more sophisticated methods... one is to use the sentencechunker results and look for noun->verb->noun sequential combinations, and assert the noun phrases as nodes and the verb phrase as an edge (like in your example). Another way is to use the sentence Parser and come up with other similar heuristics.
Generally, I think OpenNLP's Chunker and Parser give you what you need to be creative about how you generate relations within a sentence, but of course you will have to implement what to do with the tags in your own code. These stackoverflow posts give you some code for implementing a sentence chunker http://stackoverflow.com/questions/22386160/retrieving-a-number-of-important-terms-for-a-document/22591661#22591661 and this one for using the parser http://stackoverflow.com/questions/14708047/how-to-extract-the-noun-phrases-using-open-nlps-chunking-parser/20601852#20601852 HTH MG On Wed, May 21, 2014 at 4:01 PM, Mario Gómez <[email protected]>wrote: > Hi guys! > > Is there a tool to represent the general grammar of natural text (say a > text file or a web page) in a data base, like DAVID ----- HAS A ----- > GUITAR? > I mean, to automatically generate the relation HAS A? > Or is it best to use some kind of tree? Like AIML does? > > Thanx for your time. > > Mario y Ale. >
