1
從在線演示Stanford CoreNLP與例句「可以單獨測試一個最小的軟件項目」,它給人以CC倒塌的依賴關係處理如下:斯坦福核心NLP缺少根
root (ROOT-0 , item-4)
det (item-4 , A-1)
amod (item-4 , minimal-2)
nn (item-4 , software-3)
nsubjpass (tested-8 , that-5)
aux (tested-8 , can-6)
auxpass (tested-8 , be-7)
rcmod (item-4 , tested-8)
prep_in (tested-8 , isolation-10)
從我的Java類,我得到除了根(...)。我正在運行的代碼如下:
public static void main(String[] args)
{
Properties props = new Properties();
props.put("annotators", "tokenize, ssplit, pos, lemma, ner, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
Annotation document = new Annotation(args[0]);
pipeline.annotate(document);
List<CoreMap> sentences = document.get(CoreAnnotations.SentencesAnnotation.class);
for (CoreMap sentence : sentences) {
SemanticGraph dependencies = sentence.get(SemanticGraphCoreAnnotations.CollapsedCCProcessedDependenciesAnnotation.class);
System.out.println(dependencies.toList());
}
}
所以問題是爲什麼我的Java代碼不輸出root`s!?我錯過了什麼嗎?
我設法找到了我的情況下,其他的解決方案: 'GrammaticalStructure GS = gsf.newGrammaticalStructure(樹);'' 收集 TDL = gs.typedDependenciesCCprocessed();' –
werd
2013-05-01 22:06:54
是的,行之有效的,因爲ROOT真的在這個依賴關係集合中。次要的成本是,你正在付錢讓它們從分析樹中第二次生成。 – 2013-05-02 22:43:32