English grammar for parsing in NLTK

后端 未结 8 874
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 20:02

Is there a ready-to-use English grammar that I can just load it and use in NLTK? I\'ve searched around examples of parsing with NLTK, but it seems like that I have to manual

8条回答
  •  感动是毒
    2020-11-29 20:48

    Did you try POS tagging in NLTK?

    text = word_tokenize("And now for something completely different")
    nltk.pos_tag(text)
    

    The answer is something like this

    [('And', 'CC'), ('now', 'RB'), ('for', 'IN'), ('something', 'NN'),('completely', 'RB'), ('different', 'JJ')]
    

    Got this example from here NLTK_chapter03

提交回复
热议问题