spaCy - Doc._ _iter_ _ Method



This method of Doc class will iterate over those token objects from which the annotations can be easily accessed.

Example

An example Doc._ _iter_ _ is as follows −

import spacy
nlp_model = spacy.load("en_core_web_sm")
doc = nlp_model("This is Tutorialspoint.com.")
[t.text for t in doc]

Output

['This', 'is', 'Tutorialspoint.com']
spacy_containers.htm
Advertisements