spaCy - Token._ _init_ _ Method



This is one of the most useful methods of Token class. As name implies, it is used to construct a Token object.

Arguments

The table below explains its arguments −

NAME TYPE DESCRIPTION
vocab Vocab This argument represents a storage container for the lexical types.
Doc Doc It represents the parent document.
ffset Int An integer type argument that represents the token within the document.

Example

An example of Token._ _init_ _ method is as follows −

import spacy
nlp_model = spacy.load("en_core_web_sm")
doc = nlp_model("The website is Tutorialspoint.com.")
token = doc[3]
token.text

Output

You will get the following output −

'Tutorialspoint.com'
spacy_container_token_class.htm
Advertisements