Skip to main content

splitTextIntoSentences

Stentor API Reference


Stentor API Reference / stentor-utils/src / splitTextIntoSentences

Function: splitTextIntoSentences()

splitTextIntoSentences(text): string[]

Defined in: packages/stentor-utils/src/text.ts:12

Splits a given text into sentences. A sentence is considered to end with a period, exclamation mark, or question mark followed by a space or end of string.

If no sentences are found, an array with the original text is returned.

Parameters​

text​

string

The input text to be split into sentences.

Returns​

string[]

An array of sentences.