Articles → NLP → Span In Spacy

Span In Spacy






Purpose





Syntax


Span(doc, start_index, end_index)





Installations And Downloads


pip install spacy
python -m spacy download en_core_web_sm



Example


import spacy
from spacy.tokens import Span

nlp = spacy.load("en_core_web_sm")
doc = nlp("Apple is looking at buying a U.K. startup")

span = Span(doc, 0, 1)  
print(span.text)



Output


Picture showing the output of span in spacy





Posted By  -  Karan Gupta
 
Posted On  -  Monday, December 29, 2025
 
Updated On  -  Thursday, May 21, 2026

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250