这是我的代码的一部分:
String sentence = "The system Does Not Require users to identify themselves to search for books according to certain criteria and to check the availability of a particular book. However to check out books, to check their respective book loan status, and to place holds on books that are already on loan, users must first identify themselves to the system."; Parse topParses[] =ParserTool.parseLine(sentence, parser, /*numParses=*/ 3); for (Parse parseTree: topParses){ parseTree.show();
我怎样才能在句子中获得动词?请!
我的意思是,我怎样才能得到树的节点?
答案 0 :(得分:0)
如果只需要从句子中获取动词,那么opennlp中的POSTagger就足够了。您所要做的就是使用Opennlp标记器来获取数组中的标记并将其提供给POSTaggerME。它会给你相应的POS标签。然后你可以按照VB,VBZ等动词的标签进行过滤。
答案 1 :(得分:0)
如果您正在寻找动词短语,请使用Chunker,如果您只需要动词,请使用POS标记器。 看看这个答案 How to extract the noun phrases using Open nlp's chunking parser