【发布时间】:2015-04-03 11:24:25
【问题描述】:
如何在没有POS tags 的情况下从选区解析树中提取名词短语String / Text。
我能够在不解析注释的情况下提取名词短语,但无法找到仅提取该名词短语文本的方法。 例如:
String some_sentence = "The dog ran after the intruding bigger dog";
parse Tree :**(ROOT (S (NP (DT The) (NN dog)) (VP (VBD ran) (PP (IN after) (NP (DT the) (JJ intruding) (JJR bigger) (NN dog))))))
我可以从这个解析树(NP (DT The) (NN dog))" and "(NP (DT the) (JJ intruding) 中提取以下名词短语,但我只需要这些名词短语的文本作为 The dog" 和 "the intruding。
我尝试使用 Tree 类的 yieldWords() 方法构造短语,但它不能保证源字符串的精确再现,因为可能存在空格、符号等问题。
有没有办法从 Parse 树中获取准确的源字符串??
【问题讨论】:
-
您是使用 Stanford CoreNLP 管道还是直接使用 Stanford Parser?
-
我正在使用斯坦福 CoreNLP 管道进行解析。
标签: stanford-nlp text-parsing string-parsing