4

说我有一句话:

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.
    }
}

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

4

1 回答 1

1

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

于 2011-10-25T00:20:38.930 回答