Documentation

ParsingCoordinator

Coordinates parsing operations, providing a facade for the parser system.

This class handles parser selection, preprocessing, and database persistence. It serves as the main entry point for text parsing operations.

Tags
since
3.0.0

Table of Contents

Properties

$registry  : ParserRegistry

Methods

__construct()  : mixed
getRegistry()  : ParserRegistry
Get the parser registry.
parseAndSave()  : void
Parse text and save to database.
parseForPreview()  : ParserResult
Parse text and return the result without database operations.
splitIntoSentences()  : array<string|int, string>
Split text into sentences without database operations.
checkExpressions()  : bool
Check for multi-word expressions and populate tempexprs.
insertTokensToTemp()  : void
Insert tokens into temp_word_occurrences table.
preprocess()  : string
Preprocess text before parsing.
registerSentencesTextItems()  : void
Register sentences and text items in the database.
saveToDatabase()  : void
Save parsing result to database.

Properties

Methods

parseAndSave()

Parse text and save to database.

public parseAndSave(string $text, Language $language, int $textId) : void
Parameters
$text : string

Text to parse

$language : Language

Language entity

$textId : int

Text ID (must be positive)

Tags
throws
InvalidArgumentException

If textId is not positive

splitIntoSentences()

Split text into sentences without database operations.

public splitIntoSentences(string $text, Language $language) : array<string|int, string>
Parameters
$text : string

Text to parse

$language : Language

Language entity

Return values
array<string|int, string>

Array of sentences

checkExpressions()

Check for multi-word expressions and populate tempexprs.

protected checkExpressions(int $lid) : bool
Parameters
$lid : int

Language ID

Return values
bool

True if multi-word expressions were found

insertTokensToTemp()

Insert tokens into temp_word_occurrences table.

protected insertTokensToTemp(ParserResult $result, int $startSeID) : void
Parameters
$result : ParserResult

Parsing result

$startSeID : int

Starting sentence ID

preprocess()

Preprocess text before parsing.

protected preprocess(string $text, Language $language) : string

Applies character substitutions and other text cleanup.

Parameters
$text : string

Raw text

$language : Language

Language entity

Return values
string

Preprocessed text

registerSentencesTextItems()

Register sentences and text items in the database.

protected registerSentencesTextItems(int $tid, int $lid, bool $hasmultiword) : void
Parameters
$tid : int

Text ID

$lid : int

Language ID

$hasmultiword : bool

Whether to process multi-word expressions


        
On this page

Search results