dependencies - Stanford Core NLP Parse tree without a root -
i'm using stanford corenlp getting dependency trees of sentences. problem came accross is, of sentences, tree not have root node. possible?
here, there similar example in problem detected print method (i.e. there root, somehow not being printed).
however, in case, sentence not have root @ all. here test sentence have: "(wendigo is) why go cinema : fed through eye , heart , mind ."
i'm printing dependencies using following code:
semanticgraph dependencies = sentence.get(collapsedccprocesseddependenciesannotation.class); out.println(dependencies.tostring("plain")); and here output:
nsubj(-rrb--4, wendigo-2) cop(-rrb--4, is-3) advmod(go-7, why-5) nsubj(go-7, we-6) advcl(-rrb--4, go-7) det(cinema-10, the-9) prep_to(go-7, cinema-10) aux(fed-14, to-12) auxpass(fed-14, be-13) parataxis(go-7, fed-14) det(eye-17, the-16) prep_through(fed-14, eye-17) det(heart-20, the-19) appos(eye-17, heart-20) det(mind-23, the-22) appos(heart-20, mind-23) once try print root node manually, using following code:
indexedword root = dependencies.getfirstroot(); out.printf("root(root-0, %s-%d)%n", root.word(), root.index()); i following error message:
exception in thread "main" java.lang.runtimeexception: no roots in graph: dep reln gov --- ---- --- wendigo-2 nsubj -rrb--4 is-3 cop -rrb--4 why-5 advmod go-7 we-6 nsubj go-7 go-7 advcl -rrb--4 the-9 det cinema-10 cinema-10 prep_to go-7 to-12 aux fed-14 be-13 auxpass fed-14 fed-14 parataxis go-7 the-16 det eye-17 eye-17 prep_through fed-14 the-19 det heart-20 heart-20 appos eye-17 the-22 det mind-23 mind-23 appos heart-20 find graph created , make sure you're adding roots. the questions are:
- do every sentence has have root node in dependency tree?
- can sentence have more 1 root node? if yes, how going tree then?
thanks,
it looks bug caused parser wrongly generating adjective phrase constituent contained right parenthesis, sent dependencies haywire (the right parenthesis became governor, deleted punctuation).
someone seems have fixed already. current version (in github) gives dependencies below. so, new version we're releasing week (apr 2015) should fix things you....
root(root-0, is-3) nsubj(is-3, wendigo-2) advmod(go-7, why-5) nsubj(go-7, we-6) advcl(is-3, go-7) case(cinema-10, to-8) det(cinema-10, the-9) nmod:to(go-7, cinema-10) mark(fed-14, to-12) auxpass(fed-14, be-13) parataxis(go-7, fed-14) case(eye-17, through-15) det(eye-17, the-16) nmod:through(fed-14, eye-17) det(heart-20, the-19) appos(eye-17, heart-20) det(mind-23, the-22) appos(heart-20, mind-23)
Comments
Post a Comment