Noun phrases with spacy

后端 未结 3 1262
予麋鹿
予麋鹿 2020-12-07 21:22

How can I extract noun phrases from text using spacy?
I am not referring to part of speech tags. In the documentation I cannot find anything about noun phrases or regul

3条回答
  •  轮回少年
    2020-12-07 21:42

    If you want to specify more exactly which kind of noun phrase you want to extract, you can use textacy's matches function. You can pass any combination of POS tags. For example,

    textacy.extract.matches(doc, "POS:ADP POS:DET:? POS:ADJ:? POS:NOUN:+")
    

    will return any nouns that are preceded by a preposition and optionally by a determiner and/or adjective.

    Textacy was built on spacy, so they should work perfectly together.

提交回复
热议问题