我正在尝试使用 ViterbiParser 和 ChartParser 来解析句子“Birds fly”。跟踪过程,似乎它应该工作,但总是返回None
这是痕迹。(维特比):
Inserting tokens into the most likely constituents table...
Insert: |=.| Birds
Insert: |.=| fly
Finding the most likely constituents spanning 1 text elements...
Insert: |=.| NNS -> 'Birds' [1.0]
Insert: |=.| NP -> NNS [0.206897]
Insert: |.=| VB -> 'fly' [1.0]
Insert: |.=| VP -> VB [0.21875]
Finding the most likely constituents spanning 2 text elements...
Insert: |==| S -> NP VP [1.0]
图表解析器:
|. Birds . fly .|
Leaf Init Rule:
|[---------------] .| [0:1] 'Birds'
|. [---------------]| [1:2] 'fly'
Bottom Up Predict Combine Rule:
|[---------------] .| [0:1] NNS -> 'Birds' *
Bottom Up Predict Combine Rule:
|[---------------] .| [0:1] NP -> NNS *
Bottom Up Predict Combine Rule:
|[---------------> .| [0:1] NP -> NP * NP
|[---------------> .| [0:1] S -> NP * VP
Bottom Up Predict Combine Rule:
|. [---------------]| [1:2] VB -> 'fly' *
Bottom Up Predict Combine Rule:
|. [---------------]| [1:2] VP -> VB *
|. [--------------->| [1:2] VP -> VB * VP
|. [--------------->| [1:2] VP -> VB * ADJP
|. [--------------->| [1:2] VP -> VB * PP
Bottom Up Predict Combine Rule:
|. [--------------->| [1:2] VP -> VP * PP
|. [--------------->| [1:2] VP -> VP * NP
|. [--------------->| [1:2] VP -> VP * VP
Single Edge Fundamental Rule:
|[===============================]| [0:2] S -> NP VP *
两个解析器似乎都正确地构建了句子,但仍然返回 None。这是怎么回事?