Split Text into Sentences with spaCy

How to use spaCy to split text into sentences, what the output units look like, and practical constraints to check for your text-splitting workflow.

What sentence splitting means here

In this context, splitting text into sentences means taking a single input string and separating it into individual sentence strings. The input is the source text; the intended output units are sentence objects, and the practical purpose is usually to prepare text for analysis, summary, translation, search indexing, or further natural language processing.

Using spaCy for sentence segmentation

With spaCy, you begin by loading a pipeline with a parser or sentence segmentation component. A model such as the small English pipeline includes the components needed for sentence boundary detection.

After processing a document, each span in the document's sentences iterable is a sentence segment. You can convert each span to a string to obtain the separated sentence text.

import spacy

nlp = spacy.load("en_core_web_sm")
text = "First sentence. Second sentence! Third sentence?"
doc = nlp(text)

sentences = [sent.text for sent in doc.sents]

What the output gives you

The output is a list of sentence strings. Sentence segmentation identifies structural boundaries such as periods, exclamation marks, and question marks. It changes the representation of the text—from one continuous string into separate sentence units—but it does not visually wrap lines or alter the underlying wording.

Practical constraints and gaps

Sentence splitting is distinct from fixed-length splitting. spaCy does not guarantee a specific sentence count or segment length; the output depends on the model and the text. Abbreviations, decimals, quoted speech, and informal texts can affect boundary detection, so inspect the result for your intended outcome.

This explanation covers the general documented behavior of spaCy sentence segmentation. It does not provide performance measurements or compare specific model versions here because no supplied evidence supports those claims.