import {Entity} from "./entity"; export class PersonExtractor implements Entity { private _domain: string = ''; private _internal: any = {}; private _results: any[] = []; constructor(obj?) { if (obj) { if (obj.internal) { this._internal = obj.internal; } if (obj.domain) { this._domain = obj.domain; } if (obj.results) { for (const i in obj.results) { this._results.push(new OnePersonExtractor(obj.results[i])); } } } } get domain(): string { return this._domain; } set domain(value: string) { this._domain = value; } get internal(): any { return this._internal; } set internal(value: any) { this._internal = value; } get results(): any[] { return this._results; } set results(value: any[]) { this._results = value; } public toJSON() { return { domain: this.domain, internal: this.internal, results: this.results, }; } public toNerEntities(type = 1) { return { relationOptions: [], entities: new OnePersonRecordNer() }; } nerEntityTypeOptions(): any[] { return []; } } export class OnePersonExtractor{ page_uid: string = ''; no_records: number = 0; text: string[] = []; url = ''; page_storage_path = ''; person_records: OnePersonRecord[] = []; constructor(obj?) { if (obj) { if (obj.page_uid) { this.page_uid = obj.page_uid; } if (obj.no_records) { this.no_records = obj.no_records; } if (obj.text) { this.text = obj.text; } if (obj.url) { this.url = obj.url; } if (obj.page_storage_path) { this.page_storage_path = obj.page_storage_path; } if (obj.person_records) { for (const i in obj.person_records) { this.person_records.push(new OnePersonRecord(obj.person_records[i])); } } } } } export class OnePersonRecord { private name: any = { full_name: '', prefix: '', first: '', middle: '', last: '', suffix: '', credentials: '', }; private tc: any = { title: '', company: '', department: '', dozi_company_ids: '', copyrights: '', slogan: '' }; private location: any = { address: '', city: '', state: '', zip: '', country: '' }; private connections: any = { phones: [], mobiles: [], faxes: [], emails: [], urls: [] }; private bio: string = ''; constructor(obj?) { let key; if (obj) { if (obj.name) { for (key in this.name) { if (obj.name[key]) { this.name[key] = obj.name[key]; } } } if (obj.tc) { for (key in this.tc) { if (obj.tc[key]) { this.tc[key] = obj.tc[key]; } } } if (obj.location) { for (key in this.location) { if (obj.location[key]) { this.location[key] = obj.location[key]; } } } if (obj.connections) { for (key in this.connections) { if (obj.connections[key]) { if (Array.isArray(obj.connections[key])) { this.connections[key] = obj.connections[key].slice(); } else { this.connections[key].push(obj.connections[key]); } } } } if (obj.bio) { this.bio = obj.bio; } } } } export class OnePersonRecordNer { private name: any = { full_name: '', prefix: '', first: '', middle: '', last: '', suffix: '', // credentials: '', }; private tc: any = { title: '', company: '', department: '', // dozi_company_id: '', // copyrights: '', // slogan: '' }; private location: any = { address: '', city: '', state: '', // zip: '', country: '' }; private connections: any = { // phone: "", // mobile: "", // fax: "", // email: "", // url: "" }; private bio: string = ''; constructor(obj?) { let key; if (obj) { if (obj.name) { for (key in this.name) { if (obj.name[key]) { this.name[key] = obj.name[key]; } } } if (obj.tc) { for (key in this.tc) { if (obj.tc[key]) { this.tc[key] = obj.tc[key]; } } } if (obj.location) { for (key in this.location) { if (obj.location[key]) { this.location[key] = obj.location[key]; } } } if (obj.connections) { for (key in this.connections) { if (obj.connections[key]) { if (obj.connections[key]) { this.connections[key] = obj.connections[key]; } } } } if (obj.bio) { this.bio = obj.bio; } } } }