PositionField
extends BaseField
in package
A field indicating a position or area on the document.
Table of Contents
Properties
- $boundingBox : Polygon|null
- $confidence : float
- $pageId : int|mixed|null
- $polygon : Polygon|null
- $quadrangle : Polygon|null
- $reconstructed : bool
- $rectangle : Polygon|null
- $value : Polygon|null
Methods
- __compare() : bool
- Compares with the value of another field.
- __construct() : mixed
- __toString() : string
- setConfidence() : void
- Sets the confidence score.
- getPolygon() : Polygon|null
- Retrieves the polygon of a prediction.
- getQuadrilateral() : Polygon|null
- Retrieves the quadrilateral of a prediction.
Properties
$boundingBox
public
Polygon|null
$boundingBox
Straight rectangle of cropped area (does not exceed the canvas).
$confidence
public
float
$confidence
The confidence score.
$pageId
public
int|mixed|null
$pageId
The document page on which the information was found.
$polygon
public
Polygon|null
$polygon
Polygon of cropped area.
$quadrangle
public
Polygon|null
$quadrangle
Quadrangle of cropped area (does not exceed the canvas).
$reconstructed
public
bool
$reconstructed
Whether the field was reconstructed from other fields.
$rectangle
public
Polygon|null
$rectangle
Oriented rectangle of cropped area (may exceed the canvas).
$value
public
Polygon|null
$value
Polygon of cropped area, identical to the polygon
property.
Methods
__compare()
Compares with the value of another field.
public
__compare(BaseField $obj) : bool
Parameters
- $obj : BaseField
-
Field to compare.
Return values
bool__construct()
public
__construct(array<string|int, mixed> $rawPrediction[, int|null $pageId = null ][, bool $reconstructed = false ][, string $valueKey = 'polygon' ]) : mixed
Parameters
- $rawPrediction : array<string|int, mixed>
-
Raw prediction array.
- $pageId : int|null = null
-
Page id.
- $reconstructed : bool = false
-
Whether the field was reconstructed.
- $valueKey : string = 'polygon'
-
Key to use for the value.
__toString()
public
__toString() : string
Return values
string —String representation.
setConfidence()
Sets the confidence score.
protected
setConfidence(array<string|int, mixed> $rawPrediction) : void
Parameters
- $rawPrediction : array<string|int, mixed>
-
Raw prediction array.
getPolygon()
Retrieves the polygon of a prediction.
private
static getPolygon(array<string|int, mixed> $rawPrediction, string $key) : Polygon|null
Parameters
- $rawPrediction : array<string|int, mixed>
-
Raw prediction array.
- $key : string
-
Key to use for the value.
Return values
Polygon|nullgetQuadrilateral()
Retrieves the quadrilateral of a prediction.
private
static getQuadrilateral(array<string|int, mixed> $rawPrediction, string $key) : Polygon|null
Parameters
- $rawPrediction : array<string|int, mixed>
-
Raw prediction array.
- $key : string
-
Key to use for the value.