注释有标准名称(如tokenize,ssplit,pos),但我不确定应该为CoNLLDepAnnotations和GovernorAnnotations指定什么名称,以及这些注释取决于其他注释。
答案 0 :(得分:0)
Dependency Parse需要注释器(解析)。您提到的所有依赖项都在此注释器下执行。下面的代码将以List格式打印句子的语义图。
for (CoreMap sentenceAnnotation:art.sentences){
SemanticGraph deps = sentenceAnnotation.get(SemanticGraphCoreAnnotations.CollapsedDependenciesAnnotation.class);
System.out.println(deps.toList());
}
例如句子的输出:Apple even went as far to make an electric guitar version .
将是:
root(ROOT-0, went-3)
nsubj(went-3, Apple-1)
advmod(went-3, even-2)
advmod(far-5, as-4)
advmod(went-3, far-5)
mark(make-7, to-6)
xcomp(went-3, make-7)
det(version-11, an-8)
amod(version-11, electric-9)
compound(version-11, guitar-10)
dobj(make-7, version-11)
punct(went-3, .-12)
对于第一个标记Apple
,关系是nsubj,调控器是第三个标记went
。