spaCy - Span.merge Method
As the name implies, this method of Span class will retokenize the document in a way that the span is merged into a single token.
Example
An example of Span.merge method is as follows −
import spacy
nlp_model = spacy.load("en_core_web_sm")
doc = nlp_model("This is Tutorialspoint.com.")
span = doc[1:4]
doc[2].text
Output
When you run the code, you will see the following output −
'Tutorialspoint.com'
spacy_container_span_class.htm
Advertisements