What is a Doc?
- A
Doctakes in our raw input text - A
Docreturns a sequence ofTokenobjects - A
Docobject is an array ofTokenobjects
Sample Code
>>> from spacy.tokens import Doc
# We can initialize Docs using nlp
>>> doc = nlp('Hello World! This is an example.')
# Check type of object
>>> type(doc)
spacy.tokens.doc.Doc
# Docs are basically arrays
>>> doc[0].text
'Hello'
>>> doc[2].text
'!'
>>> doc[5].text
'an'
# Check type of elements in Doc
>>> type(doc[0])
spacy.tokens.token.TokenReferences
Next