python-3.xnlpspacy

How to get all words from spacy vocab?


I need all the words from Spacy vocab. Suppose, I initialize my spacy model as

nlp = spacy.load('en')

How do I get the text of words from nlp.vocab?


Solution

  • You can get it as a list like this:

    list(nlp.vocab.strings)