【问题标题】:Stanford Core NLP Parse tree without a root没有根的斯坦福核心 NLP 解析树
【发布时间】:2015-04-20 05:26:46
【问题描述】:

我正在使用 Stanford CoreNLP 获取句子的依赖树。 我遇到的问题是,对于某些句子,树没有根节点。这可能吗?

Here,有一个类似的示例,其中检测到问题与打印方法有关(即有一个根,但不知何故它没有被打印)。

但是,就我而言,这句话根本没有词根。这是我的测试句子:“(Wendigo 是)我们去电影院的原因:通过眼睛,心脏,思想来喂养。”

我正在使用以下代码打印依赖项:

SemanticGraph dependencies = sentence.get(CollapsedCCProcessedDependenciesAnnotation.class);
out.println(dependencies.toString("plain"));

这是输出:

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)

一旦我尝试使用以下代码手动打印根节点:

IndexedWord root = dependencies.getFirstRoot();
out.printf("ROOT(root-0, %s-%d)%n", root.word(), root.index());

我收到以下错误消息:

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 where this graph was created and make sure you're adding roots.

问题是:

  1. 每个句子都必须在其依赖树中有一个根节点吗?
  2. 一个句子可以有多个根节点吗?如果是,那它怎么会是一棵树呢?

谢谢,

【问题讨论】:

    标签: dependencies root stanford-nlp


    【解决方案1】:

    这看起来是由于解析器错误地生成了仅包含右括号的形容词短语成分导致的错误,这使依赖关系变得混乱(右括号成为了州长,但随后被删除为标点符号)。

    似乎有人已经解决了这个问题。当前版本(在 github 中)提供了以下依赖项。因此,我们本周(2015 年 4 月)发布的新版本有望为您解决问题....

    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)
    

    【讨论】:

      猜你喜欢
      • 2014-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多