Detect English verb tenses using NLTK

前端 未结 2 1354
终归单人心
终归单人心 2021-02-04 08:28

I am looking for a way given an English text count verb phrases in it in past, present and future tenses. For now I am using NLTK, do a POS (Part-Of-Speech) tagging, and then co

相关标签:
2条回答
  • 2021-02-04 08:37

    You can do this with either the Berkeley Parser or Stanford Parser. But I don't know if there's a Python interface available for either.

    0 讨论(0)
  • 2021-02-04 08:38

    Thee exact answer depends on which chunker you intend to use, but list comprehensions will take you a long way. This gets you the number of verb phrases using a non-existent chunker.

    len([phrase for phrase in nltk.Chunker(sentence) if phrase[1] == 'VP'])
    

    You can take a more fine-grained approach to detect numbers of tenses.

    0 讨论(0)
提交回复
热议问题