从 Penn Treebank 格式的文本中提取子句

问题描述 投票:0回答:2

说我有句话:

After he had eaten the cheese, Bill went to the grocery.

在我的程序中,我得到以下输出:

---PARSE TREE---
(ROOT
  (S
    (SBAR (IN After)
      (S
        (NP (PRP he))
        (VP (VBD had)
          (VP (VBN eaten)
            (NP (DT the) (NN cheese))))))
    (, ,)
    (NP (NNP Bill))
    (VP (VBD went)
      (PP (TO to)
        (NP (DT the) (NN grocery))))
    (. .)))

如何将不在子句内的内容合并为独立子句?像这样:

S Clause {
    SBAR Clause {
         After he had eaten the cheese,
    }

    S Clause {
        Bill went to the grocery.
    }
}

我很确定我不清楚,但基本上我想提取句子的独立子句和从属子句,以及这些子句的子句。

nlp stanford-nlp
2个回答
1
投票

这里是NLTK指南中的演示代码(它没有明确显示如何提取子句): http://nltk.googlecode.com/svn/trunk/doc/howto/tree.html


0
投票

很抱歉打扰您。我现在也在做这个任务。我已经用Standford Parser工具解析了这个句子,但我不知道如何从解析树中分割和提取子句。我想问一下你的问题是怎么解决的?因为到目前为止我还不知道有任何可能的工具可以完成这项任务。我知道您发布问题已经有一段时间了。不过,我真诚地希望您能与我分享您的经验。我将非常感激!

© www.soinside.com 2019 - 2024. All rights reserved.