Documentation

ParseText

Use case for text parsing operations.

Handles text parsing preview and validation without saving, useful for checking text before import.

Tags
since
3.0.0

Table of Contents

Methods

execute()  : array{sentences: int, words: int, unknownPercent: float, preview: string}
Check/preview text parsing without saving.
getTextLengthInfo()  : array{bytes: int, characters: int, words: int, valid: bool}
Get text length info.
setTermSentences()  : int
Set term sentences for words from texts.
validateTextLength()  : bool
Validate text length (max 65000 bytes for MySQL TEXT column).

Methods

execute()

Check/preview text parsing without saving.

public execute(string $text, int $languageId) : array{sentences: int, words: int, unknownPercent: float, preview: string}
Parameters
$text : string

Text content to parse

$languageId : int

Language ID

Return values
array{sentences: int, words: int, unknownPercent: float, preview: string}

getTextLengthInfo()

Get text length info.

public getTextLengthInfo(string $text) : array{bytes: int, characters: int, words: int, valid: bool}
Parameters
$text : string

Text content

Return values
array{bytes: int, characters: int, words: int, valid: bool}

setTermSentences()

Set term sentences for words from texts.

public setTermSentences(array<string|int, mixed> $textIds[, bool $activeOnly = false ]) : int

Links words to sentences they appear in.

Parameters
$textIds : array<string|int, mixed>

Array of text IDs

$activeOnly : bool = false

Only update active (non-well-known) words

Return values
int

Number of terms updated

validateTextLength()

Validate text length (max 65000 bytes for MySQL TEXT column).

public validateTextLength(string $text) : bool
Parameters
$text : string

Text to validate

Return values
bool

True if valid, false if too long


        
On this page

Search results