Articles → NLP → Span In Spacy

Span In Spacy






Purpose





Syntax


Span(doc, start_index, end_index)



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

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250