Skip to main content

text-to-sentences

ai-research-agent / tokenize/text-to-sentences

Topics

splitSentences()

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

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)