【发布时间】:2019-07-08 07:28:38
【问题描述】:
我想在句子结构中找到模式。因此,我试图将解析树作为预处理。
到目前为止,我使用的是 Stanford CoreNLPParser。 我的很多句子都是祈使句。 在收到比预期更多的集群后,我查看了解析树,发现我的祈使句开头的动词经常被解析为名词短语 (NP)。
我找到了以下答案:https://stackoverflow.com/a/35887762/6068675
由于这个答案来自 2016 年,我希望可能有另一种选择来获得更好的结果。 句子中的每个第一个单词只小写看起来不是一个理想的解决方案。
我列举了几个解析错误的例子:
(ROOT (S (S (NP (NNP View)) (NP (NP (DT a) (NN list)) (PP (IN of) (NP (JJ ongoing) (NNS sales) (NNS quotes))) (PP (IN for) (NP (DT the) (NN customer))))) (. .)))
(ROOT (NP (NP (NN Request) (NN approval) (S (VP (TO to) (VP (VB change) (NP (DT the) (NN record)))))) (. .)))
更多示例
(ROOT (NP (NP (NNP View)) (CC or) (VP (VB change) (NP (NP (JJ detailed) (NN information)) (PP (IN about) (NP (DT the) (NN customer))))) (. .)))
(ROOT (FRAG (PP (IN Post) (NP (DT the) (VBN specified) (NN prepayment) (NN information))) (. .)))
(ROOT (S (S (NP (NNP View)) (NP (NP (DT a) (NN summary)) (PP (IN of) (NP (DT the) (NN debit) (CC and) (NN credit) (NNS balances))) (PP (IN for) (NP (JJ different) (NN time) (NNS periods))))) (. .)))
(ROOT (NP (NP (NP (NN Offer) (NNS items)) (CC or) (NP (NP (NNS services)) (PP (TO to) (NP (DT a) (NN customer))))) (. .)))
(ROOT (NP (NP (NP (NNP View)) (CC or) (VP (VB add) (NP (NP (NNS comments)) (PP (IN for) (NP (DT the) (NN record)))))) (. .)))
【问题讨论】:
-
工具推荐问题在这里是题外话,但也许可以试试 Spacy?
-
好的。我试着改写我的问题。我想让我的命令句被正确解析。如您所见,视图未解析为动词短语。
-
您能否提供更多有关命令式解析问题的示例。
-
我添加了一些解析问题的示例。主要是任何以 View 开头的句子。小写不会改善我的解析结果。
-
你尝试过 BERT 吗?
标签: python stanford-nlp parse-tree