I am using UIMA in combination with UIMAfit and dkpro and the StanfordParser to parse english sentences.
I can build dependency trees without any problem. For "and"/"or" conjunctions, I get a Annotation with class CONJ
, which is a subclass of Dependency
. As of now, I did not find out, how to check if the found conjunction is an "AND" or an "OR" conjunction.
Does anybody know how to solve this? I saw examples where the dependencies "conj_and" and "conj_or" are displayed, but I dont see where they come from. http://nlp.stanford.edu/software/dependencies_manual.pdf
Thanks in advance
Some code for visualization:
// CONJ a;
// StringBuilder sb
Token dependent = a.getDependent();
Token governor = a.getGovernor();
sb.append("Dependent: ");
sb.append(dependent);
sb.append(", ");
sb.append("Governor: ");
sb.append(governor);
// How to check type conj_and/conj_or?
The method to get the label of the dependency relation is called
getDependencyType()
Mind that the conj_or
is a "collapsed dependency". If you want to get these, you have to explicitly set the dependency mode when invoking the DKPro Core StanfordParser component, e.g. using COLLAPSED
or maybe CC_PROPAGATED
:
AnalysisEngineFactory.createEngineDescription(StanfordParser.class,
StanfordParser.PARAM_MODE, StanfordParser.DependenciesMode.COLLAPSED)
The default setting for this parameter is TREE
.
See also:
Disclosure: I am a member of the DKPro Core team.