@briancullen/aws-textract-parser
Version:
Library for converting AWS Textract responses into a more usable structure.
23 lines (22 loc) • 966 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var WordBlockNode_1 = __importDefault(require("../model/WordBlockNode"));
var WordParser = /** @class */ (function () {
function WordParser(geometryParser, blockIdParser) {
this.geometryParser = geometryParser;
this.blockIdParser = blockIdParser;
}
WordParser.prototype.process = function (word) {
var _a, _b;
var id = this.blockIdParser(word);
var geometry = this.geometryParser(word);
var confidence = (_a = word.Confidence, (_a !== null && _a !== void 0 ? _a : 0));
var text = (_b = word.Text, (_b !== null && _b !== void 0 ? _b : ''));
return new WordBlockNode_1.default(id, geometry, text, confidence);
};
return WordParser;
}());
exports.default = WordParser;
;