OcrPage
in package
OCR extraction for a single page.
Table of Contents
Properties
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
Return values
intgetMinMaxY()
Compares word positions on the Y axis. Returns a sort-compliant result (0;-1;1).
public
static getMinMaxY(OcrWord $word1, OcrWord $word2) : int
Parameters
Return values
intareWordsOnSameLine()
Checks whether the words are on the same line.
private
static areWordsOnSameLine(OcrWord $currentWord, OcrWord $nextWord) : bool
Parameters
Return values
booltoLines()
Puts all words on the page into an array of lines.
private
toLines() : array<string|int, mixed>