Skip to main content

text-to-sentences

Documentation / tokenize/text-to-sentences

Topics​

splitSentences()​

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

Defined in: packages/ai-research-agent/src/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?

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

options.splitOnHtmlTags?

boolean

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

options.minSize?

number

default=20 - Minimum size for a sentence.

options.maxSize?

number

default=600 - Maximum size for a sentence.

Returns​

string[]

An array of sentences.

Author​

ai-research-agent (2024)