Extracting nouns from Noun Phase in NLP

前端 未结 1 422
日久生厌
日久生厌 2021-01-02 22:57

Could anyone please tell me how to extract only the nouns from the following output:

I have tokenized and parsed the string \"Give me the review of movie\" based on

相关标签:
1条回答
  • 2021-01-02 23:32

    You don't need to use a full parser to get nouns. You can simply use a tagger. One function you can use is nltk.tag.pos_tag(). This will return a list of tuples with the word and part of speech. You'll be able to iterate over the tuples and find words tagged with 'NN' or 'NNS' for noun or plural noun.

    NLTK has a how to document for how to use their taggers. It can be found here: https://nltk.googlecode.com/svn/trunk/doc/howto/tag.html and here is a link to the chapter in the NLTK book about using taggers: https://nltk.googlecode.com/svn/trunk/doc/book/ch05.html

    There are many code examples in each of those places.

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