TextTermApiHandler
in package
Handler for term translations, word retrieval, text scoring, and listing.
Table of Contents
Properties
Methods
- __construct() : mixed
- formatArchivedTextsByLanguage() : array{texts: array, pagination: array}
- Format response for getting archived texts by language.
-
formatGetRecommendedTexts()
: array{recommendations: array
[], target_comprehensibility: float} - Get recommended texts for a language based on comprehensibility.
- formatGetTextScore() : array<string, mixed>
- Get the difficulty score for a single text.
-
formatGetTextScores()
: array{scores: array
>} - Get scores for multiple texts.
- formatGetWords() : array{words: array, config: array}|array{error: string}
- Format response for getting text words.
- formatTermTranslations() : array{term_lc?: string, wid?: int|null, trans?: string, ann_index?: int, term_ord?: int, translations?: string[], language_id?: int, error?: string}
- Format response for getting term translations.
- formatTextsByLanguage() : array{texts: array, pagination: array}
- Format response for getting texts by language.
- getTermTranslations() : array{term_lc?: string, wid?: int|null, trans?: string, ann_index?: int, term_ord?: int, translations?: string[], language_id?: int, error?: string}
- Gather useful data to edit a term annotation on a specific text.
- getTranslations() : array<string|int, string>
- Find the possible translations for a term.
- getWords() : array{words: array, config: array}|array{error: string}
- Get all words for a text for client-side rendering.
Properties
$textService
private
TextFacade
$textService
Methods
__construct()
public
__construct([TextFacade|null $textService = null ]) : mixed
Parameters
- $textService : TextFacade|null = null
formatArchivedTextsByLanguage()
Format response for getting archived texts by language.
public
formatArchivedTextsByLanguage(int $langId, array<string|int, mixed> $params) : array{texts: array, pagination: array}
Parameters
- $langId : int
-
Language ID
- $params : array<string|int, mixed>
-
Query parameters (page, per_page, sort)
Return values
array{texts: array, pagination: array}formatGetRecommendedTexts()
Get recommended texts for a language based on comprehensibility.
public
formatGetRecommendedTexts(int $languageId, array<string|int, mixed> $params) : array{recommendations: array[], target_comprehensibility: float}
Parameters
- $languageId : int
-
Language ID
- $params : array<string|int, mixed>
-
Query parameters (target, limit)
Return values
array{recommendations: arrayformatGetTextScore()
Get the difficulty score for a single text.
public
formatGetTextScore(int $textId) : array<string, mixed>
Parameters
- $textId : int
-
Text ID to score
Return values
array<string, mixed>formatGetTextScores()
Get scores for multiple texts.
public
formatGetTextScores(array<string|int, int> $textIds) : array{scores: array>}
Parameters
- $textIds : array<string|int, int>
-
Array of text IDs
Return values
array{scores: arrayformatGetWords()
Format response for getting text words.
public
formatGetWords(int $textId) : array{words: array, config: array}|array{error: string}
Parameters
- $textId : int
-
Text ID
Return values
array{words: array, config: array}|array{error: string}formatTermTranslations()
Format response for getting term translations.
public
formatTermTranslations(string $termLc, int $textId) : array{term_lc?: string, wid?: int|null, trans?: string, ann_index?: int, term_ord?: int, translations?: string[], language_id?: int, error?: string}
Parameters
- $termLc : string
-
Term in lowercase
- $textId : int
-
Text ID
Return values
array{term_lc?: string, wid?: int|null, trans?: string, ann_index?: int, term_ord?: int, translations?: string[], language_id?: int, error?: string}formatTextsByLanguage()
Format response for getting texts by language.
public
formatTextsByLanguage(int $langId, array<string|int, mixed> $params) : array{texts: array, pagination: array}
Parameters
- $langId : int
-
Language ID
- $params : array<string|int, mixed>
-
Query parameters (page, per_page, sort)
Return values
array{texts: array, pagination: array}getTermTranslations()
Gather useful data to edit a term annotation on a specific text.
public
getTermTranslations(string $wordlc, int $textid) : array{term_lc?: string, wid?: int|null, trans?: string, ann_index?: int, term_ord?: int, translations?: string[], language_id?: int, error?: string}
Parameters
- $wordlc : string
-
Term in lower case
- $textid : int
-
Text ID
Return values
array{term_lc?: string, wid?: int|null, trans?: string, ann_index?: int, term_ord?: int, translations?: string[], language_id?: int, error?: string}getTranslations()
Find the possible translations for a term.
public
getTranslations(int $wordId) : array<string|int, string>
Parameters
- $wordId : int
-
Term ID
Return values
array<string|int, string>getWords()
Get all words for a text for client-side rendering.
public
getWords(int $textId) : array{words: array, config: array}|array{error: string}
Parameters
- $textId : int
-
Text ID