How to get a verb connecting two nouns in an Apache OpenNLP parse tree? -


what strategy find out verb connecting 2 nouns in parse tree, assuming exists? example, in sentence:

the man called wife before coming home.

given inputs "man" , "wife", i'd verb "called". opennlp gives me parse tree:

(top (s (np (dt the) (nn man)) (vp (vbd called) (np (prp$ his) (nn wife)) (pp (in before) (s (vp (vbg coming) (advp (rb back)))))) (. home.)))

so guess @ least partly tree navigation question. maybe first isolate verbs, test recursing down, until both nouns found?

or try find shortest path 1 noun other , save verb on way?

my problem don't know enough parse tree structure devise strategy. or should perhaps use other (java) tool?

thanks!

the task want accomplish complex. biggest problem can see here need "a verb connecting 2 nouns". generic, , maybe have saw parse trees can assume different (and "wrong") structures.

if want more generic approach problem suggest relation extraction. technique aims @ extracting binary (or n-ary) relations sentence. example tools suggest are:

with latter 1 example can extract sentences relations of form subject-action-object. regard question work if 2 nouns respectively subject , object of phrase.

if instead want verb connecting 2 name think navigation of tree direct solution, pointed out before, difficult implement given "imperfection" , non-standard structure of natural language phrases.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -