- spaCy - Home
- spaCy - Introduction
- spaCy - Getting Started
- spaCy - Models and Languages
- spaCy - Architecture
- spaCy - Command Line Helpers
- spaCy - Top-level Functions
- spaCy - Visualization Function
- spaCy - Utility Functions
- spaCy - Compatibility Functions
- spaCy - Containers
- Doc Class ContextManager and Property
- spaCy - Container Token Class
- spaCy - Token Properties
- spaCy - Container Span Class
- spaCy - Span Class Properties
- spaCy - Container Lexeme Class
- Training Neural Network Model
- Updating Neural Network Model
- spaCy Useful Resources
- spaCy - Quick Guide
- spaCy - Useful Resources
- spaCy - Discussion
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