UNPKG

mindee

Version:

Mindee Client Library for Node.js

140 lines (139 loc) 6.12 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 _ResumeV1ProfessionalExperience_instances, _ResumeV1ProfessionalExperience_printableValues; Object.defineProperty(exports, "__esModule", { value: true }); exports.ResumeV1ProfessionalExperience = void 0; const common_1 = require("../../parsing/common"); const geometry_1 = require("../../geometry"); /** * The list of the candidate's professional experiences. */ class ResumeV1ProfessionalExperience { constructor({ prediction = {} }) { _ResumeV1ProfessionalExperience_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.contractType = prediction["contract_type"]; this.department = prediction["department"]; this.description = prediction["description"]; this.employer = prediction["employer"]; this.endMonth = prediction["end_month"]; this.endYear = prediction["end_year"]; this.role = prediction["role"]; 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, _ResumeV1ProfessionalExperience_instances, "m", _ResumeV1ProfessionalExperience_printableValues).call(this); return ("Contract Type: " + printable.contractType + ", Department: " + printable.department + ", Description: " + printable.description + ", Employer: " + printable.employer + ", End Month: " + printable.endMonth + ", End Year: " + printable.endYear + ", Role: " + printable.role + ", Start Month: " + printable.startMonth + ", Start Year: " + printable.startYear); } /** * Output in a format suitable for inclusion in an rST table. */ toTableLine() { const printable = __classPrivateFieldGet(this, _ResumeV1ProfessionalExperience_instances, "m", _ResumeV1ProfessionalExperience_printableValues).call(this); return ("| " + printable.contractType.padEnd(15) + " | " + printable.department.padEnd(10) + " | " + printable.description.padEnd(36) + " | " + printable.employer.padEnd(25) + " | " + printable.endMonth.padEnd(9) + " | " + printable.endYear.padEnd(8) + " | " + printable.role.padEnd(20) + " | " + printable.startMonth.padEnd(11) + " | " + printable.startYear.padEnd(10) + " |"); } } exports.ResumeV1ProfessionalExperience = ResumeV1ProfessionalExperience; _ResumeV1ProfessionalExperience_instances = new WeakSet(), _ResumeV1ProfessionalExperience_printableValues = function _ResumeV1ProfessionalExperience_printableValues() { return { contractType: this.contractType ? this.contractType.length <= 15 ? (0, common_1.cleanSpecialChars)(this.contractType) : (0, common_1.cleanSpecialChars)(this.contractType).slice(0, 12) + "..." : "", department: this.department ? this.department.length <= 10 ? (0, common_1.cleanSpecialChars)(this.department) : (0, common_1.cleanSpecialChars)(this.department).slice(0, 7) + "..." : "", description: this.description ? this.description.length <= 36 ? (0, common_1.cleanSpecialChars)(this.description) : (0, common_1.cleanSpecialChars)(this.description).slice(0, 33) + "..." : "", employer: this.employer ? this.employer.length <= 25 ? (0, common_1.cleanSpecialChars)(this.employer) : (0, common_1.cleanSpecialChars)(this.employer).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) + "..." : "", role: this.role ? this.role.length <= 20 ? (0, common_1.cleanSpecialChars)(this.role) : (0, common_1.cleanSpecialChars)(this.role).slice(0, 17) + "..." : "", 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) + "..." : "", }; };