Documentation

OcrPage
in package

OCR extraction for a single page.

Table of Contents

Properties

$allWords  : array<string|int, mixed>
$lines  : array<string|int, mixed>

Methods

__construct()  : mixed
__toString()  : string
getAllLines()  : array<string|int, mixed>
Retrieves all lines on the page.
getAllWords()  : array<string|int, mixed>
Retrieves all words on the page.
getMinMaxX()  : int
Compares word positions on the X axis. Returns a sort-compliant result (0;-1;1).
getMinMaxY()  : int
Compares word positions on the Y axis. Returns a sort-compliant result (0;-1;1).
areWordsOnSameLine()  : bool
Checks whether the words are on the same line.
toLines()  : array<string|int, mixed>
Puts all words on the page into an array of lines.

Properties

$allWords

private array<string|int, mixed> $allWords

List of all words.

$lines

private array<string|int, mixed> $lines

List of lines.

Methods

__construct()

public __construct(array<string|int, mixed> $rawPrediction) : mixed
Parameters
$rawPrediction : array<string|int, mixed>

Raw prediction array.

__toString()

public __toString() : string
Return values
string

String representation.

getAllLines()

Retrieves all lines on the page.

public getAllLines() : array<string|int, mixed>
Return values
array<string|int, mixed>

getAllWords()

Retrieves all words on the page.

public getAllWords() : array<string|int, mixed>
Return values
array<string|int, mixed>

getMinMaxX()

Compares word positions on the X axis. Returns a sort-compliant result (0;-1;1).

public static getMinMaxX(OcrWord $word1, OcrWord $word2) : int
Parameters
$word1 : OcrWord

First word.

$word2 : OcrWord

Second word.

Return values
int

getMinMaxY()

Compares word positions on the Y axis. Returns a sort-compliant result (0;-1;1).

public static getMinMaxY(OcrWord $word1, OcrWord $word2) : int
Parameters
$word1 : OcrWord

First word.

$word2 : OcrWord

Second word.

Return values
int

areWordsOnSameLine()

Checks whether the words are on the same line.

private static areWordsOnSameLine(OcrWord $currentWord, OcrWord $nextWord) : bool
Parameters
$currentWord : OcrWord

Reference word to compare.

$nextWord : OcrWord

Next word to compare.

Return values
bool

toLines()

Puts all words on the page into an array of lines.

private toLines() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results