UNPKG

mindee

Version:

Mindee Client Library for Node.js

120 lines (119 loc) 5.09 kB
"use strict"; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _ResumeV1Education_instances, _ResumeV1Education_printableValues; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResumeV1Education = void 0; const common_1 = require("../../parsing/common"); const geometry_1 = require("../../geometry"); /** * The list of the candidate's educational background. */ class ResumeV1Education { constructor({ prediction = {} }) { _ResumeV1Education_instances.add(this); /** Confidence score */ this.confidence = 0.0; /** * Contains the relative vertices coordinates (points) of a polygon containing * the field in the document. */ this.polygon = new geometry_1.Polygon(); this.degreeDomain = prediction["degree_domain"]; this.degreeType = prediction["degree_type"]; this.endMonth = prediction["end_month"]; this.endYear = prediction["end_year"]; this.school = prediction["school"]; this.startMonth = prediction["start_month"]; this.startYear = prediction["start_year"]; this.pageId = prediction["page_id"]; this.confidence = prediction["confidence"] ? prediction.confidence : 0.0; if (prediction["polygon"]) { this.polygon = prediction.polygon; } } /** * Default string representation. */ toString() { const printable = __classPrivateFieldGet(this, _ResumeV1Education_instances, "m", _ResumeV1Education_printableValues).call(this); return ("Domain: " + printable.degreeDomain + ", Degree: " + printable.degreeType + ", End Month: " + printable.endMonth + ", End Year: " + printable.endYear + ", School: " + printable.school + ", Start Month: " + printable.startMonth + ", Start Year: " + printable.startYear); } /** * Output in a format suitable for inclusion in an rST table. */ toTableLine() { const printable = __classPrivateFieldGet(this, _ResumeV1Education_instances, "m", _ResumeV1Education_printableValues).call(this); return ("| " + printable.degreeDomain.padEnd(15) + " | " + printable.degreeType.padEnd(25) + " | " + printable.endMonth.padEnd(9) + " | " + printable.endYear.padEnd(8) + " | " + printable.school.padEnd(25) + " | " + printable.startMonth.padEnd(11) + " | " + printable.startYear.padEnd(10) + " |"); } } exports.ResumeV1Education = ResumeV1Education; _ResumeV1Education_instances = new WeakSet(), _ResumeV1Education_printableValues = function _ResumeV1Education_printableValues() { return { degreeDomain: this.degreeDomain ? this.degreeDomain.length <= 15 ? (0, common_1.cleanSpecialChars)(this.degreeDomain) : (0, common_1.cleanSpecialChars)(this.degreeDomain).slice(0, 12) + "..." : "", degreeType: this.degreeType ? this.degreeType.length <= 25 ? (0, common_1.cleanSpecialChars)(this.degreeType) : (0, common_1.cleanSpecialChars)(this.degreeType).slice(0, 22) + "..." : "", endMonth: this.endMonth ? this.endMonth.length <= 9 ? (0, common_1.cleanSpecialChars)(this.endMonth) : (0, common_1.cleanSpecialChars)(this.endMonth).slice(0, 6) + "..." : "", endYear: this.endYear ? this.endYear.length <= 8 ? (0, common_1.cleanSpecialChars)(this.endYear) : (0, common_1.cleanSpecialChars)(this.endYear).slice(0, 5) + "..." : "", school: this.school ? this.school.length <= 25 ? (0, common_1.cleanSpecialChars)(this.school) : (0, common_1.cleanSpecialChars)(this.school).slice(0, 22) + "..." : "", startMonth: this.startMonth ? this.startMonth.length <= 11 ? (0, common_1.cleanSpecialChars)(this.startMonth) : (0, common_1.cleanSpecialChars)(this.startMonth).slice(0, 8) + "..." : "", startYear: this.startYear ? this.startYear.length <= 10 ? (0, common_1.cleanSpecialChars)(this.startYear) : (0, common_1.cleanSpecialChars)(this.startYear).slice(0, 7) + "..." : "", }; };