UNPKG

mindee

Version:

Mindee Client Library for Node.js

36 lines (35 loc) 1.3 kB
import { BaseField, BaseFieldConstructor } from "./base"; import { Polygon, BoundingBox } from "../../geometry"; /** * A basic field with position and page information. */ export declare class Field extends BaseField { /** * Contains exactly 4 relative vertices coordinates (points) of a right * rectangle containing the field in the document. */ boundingBox: BoundingBox; /** * Contains the relative vertices coordinates (points) of a polygon containing * the field in the document. */ polygon: Polygon; /** The confidence score of the prediction. */ confidence: number; /** * @param {BaseFieldConstructor} constructor Constructor parameters. */ constructor({ prediction, valueKey, reconstructed, pageId, }: BaseFieldConstructor); /** @param array1 first Array of Fields @param array2 second Array of Fields @param attr Attribute to compare @returns true if all elements in array1 exist in array2 and vice-versa, false otherwise */ static compareArrays(array1: Field[], array2: Field[], attr?: string): boolean; /** * @param {Field[]} array - Array of Fields * @returns {number} product of all the fields probability */ static arrayConfidence(array: Field[]): number; }