斯坦福nndep得到解析树

问题描述:

使用斯坦福CoreNLP,我试图解析文本使用神经网络依赖解析器。它运行速度非常快(这就是为什么我要使用这个而不是LexicalizedParser),并产生高质量的依赖关系。我也有兴趣从中检索分析树(宾州树样式)。所以,鉴于语法结构,我得到的根(使用root()),然后尝试使用toOneLineString()方法打印出来。但是,root()返回树的根节点,并带有空/空的子节点列表。在说明或常见问题解答中,我找不到任何相关内容。斯坦福nndep得到解析树

GrammaticalStructure gs = parser.predict(tagged); 

    // Print typed dependencies 
    System.err.println(gs); 

    // get the tree and print it out in the parenthesised form 
    TreeGraphNode tree = gs.root(); 
    System.err.println(tree.toOneLineString()); 

的这个输出是:

ROOT-0{CharacterOffsetBeginAnnotation=-1, CharacterOffsetEndAnnotation=-1, PartOfSpeechAnnotation=null, TextAnnotation=ROOT}Typed Dependencies: 
    [nsubj(tell-5, I-1), aux(tell-5, can-2), advmod(always-4, almost-3), advmod(tell-5, always-4), root(ROOT-0, tell-5), advmod(use-8, when-6), nsubj(use-8, movies-7), advcl(tell-5, use-8), amod(dinosaurs-10, fake-9), dobj(use-8, dinosaurs-10), punct(tell-5, .-11)] 
    ROOT-0 

我怎样才能得到解析树吗?

+0

你在寻找一个选区分析吗?或者只是查看S表达式(PTB)格式的依赖关系解析? –

+0

确切地说,CFG解析与您从lex解析器获得的解析类似。 – Claudiu

图我可以使用斯坦福大学提供的Shift-Reduce选区解析器。速度非常快,结果可比。