Is there a way to get the subject of a sentence using OpenNLP?

前端 未结 2 1101
一整个雨季
一整个雨季 2020-12-24 15:55

Is there a way to get the subject of a sentence using OpenNLP? I\'m trying to identify the most important part of a users sentence. Generally, users will be submitting sen

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-24 16:17

    For the grammatical subject you'd need to rely on configurational information in the tree. If the parse looks something like (TOP (S (NP ----) (VP ----))) then you can take the NP as the subject; often, though not at all always, that will be the case. However only some sentences will have this configuration; one can easily imagine structures with subjects that are not in that position -- passive constructions, for example.

    You're probably better off using MaltParser though.

提交回复
热议问题