Skip to main content

text-to-sentences

Documentation / tokenize/text-to-sentences

Topics​

splitSentences()​

function splitSentences(inputText: string, options?: object): string[];

Defined in: tokenize/text-to-sentences.js:14

Splits text into sentences, handling 220+ common abbreviations, and infering acronyms, numbers, URLs, times, names, etc.

Parameters​

ParameterTypeDescription

inputText

string

The text to be split into sentences.

options?

{ maxSize: number; minSize: number; splitOnHtmlTags: boolean; }

options.maxSize?

number

default=600 - Maximum size for a sentence.

options.minSize?

number

default=20 - Minimum size for a sentence.

options.splitOnHtmlTags?

boolean

default=true - Split on HTML tags like P, DIV, UL, OL.

Returns​

string[]

An array of sentences.

Author​

ai-research-agent (2024)