mindee
Version:
Mindee Client Library for Node.js
24 lines (23 loc) • 913 B
JavaScript
import { Inference, Page } from "../../../v1/parsing/common/index.js";
import { ReceiptV5Document } from "./receiptV5Document.js";
/**
* Receipt API version 5 inference prediction.
*/
export class ReceiptV5 extends Inference {
constructor(rawPrediction) {
super(rawPrediction);
/** The endpoint's name. */
this.endpointName = "expense_receipts";
/** The endpoint's version. */
this.endpointVersion = "5";
/** The document's pages. */
this.pages = [];
this.prediction = new ReceiptV5Document(rawPrediction["prediction"]);
rawPrediction["pages"].forEach((page) => {
if (page.prediction !== undefined && page.prediction !== null &&
Object.keys(page.prediction).length > 0) {
this.pages.push(new Page(ReceiptV5Document, page, page["id"], page["orientation"]));
}
});
}
}