spaCy container objects
At the beginning of this chapter, we saw a list of container objects including Doc, Token, Span, and Lexeme. We already used Token and Doc in our code. In this subsection, we'll see the properties of the container objects in detail.
Using container objects, we can access the linguistic properties that spaCy assigns to the text. A container object is a logical representation of the text units such as a document, a token, or a slice of the document.
Container objects in spaCy follow the natural structure of the text: a document is composed of sentences and sentences are composed of tokens.
We most widely use Doc, Token, and Span objects in development, which represent a document, a single token, and a phrase, respectively. A container can contain other containers, for instance a document contains tokens and spans.
Let's explore each class and its useful properties one by one.
Doc
We created Doc objects in our code to represent the...