UNPKG

pii-filter

Version:
165 lines 5.81 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MedicineName = exports.PetName = exports.FamilyName = exports.FirstName = exports.Dictionary = void 0; const Parsing = __importStar(require("../../../core/parsing")); const ds_dictionary_0_json_1 = __importDefault(require("../dataset/ds_dictionary_0.json")); const ds_dictionary_1_json_1 = __importDefault(require("../dataset/ds_dictionary_1.json")); const ds_first_name_0_json_1 = __importDefault(require("../dataset/ds_first_name_0.json")); const ds_family_name_0_json_1 = __importDefault(require("../dataset/ds_family_name_0.json")); const ds_family_name_1_json_1 = __importDefault(require("../dataset/ds_family_name_1.json")); const ds_family_name_2_json_1 = __importDefault(require("../dataset/ds_family_name_2.json")); const ds_pet_name_0_json_1 = __importDefault(require("../dataset/ds_pet_name_0.json")); const ds_medicine_name_0_json_1 = __importDefault(require("../dataset/ds_medicine_name_0.json")); function merge_json(json_objects) { let compiled_object = {}; for (const object of json_objects) { for (const key of Object.keys(object)) { if (Object.keys(compiled_object).includes(key)) { if (Array.isArray(object[key])) for (const element of object[key]) compiled_object[key].push(element); } else { compiled_object[key] = object[key]; } } } return compiled_object; } /** * The Dutch dictionary. * @private */ class Dictionary extends Parsing.CoreDictionary { /** * Creates a new Dutch dictionary. */ constructor() { super(merge_json([ds_dictionary_0_json_1.default, ds_dictionary_1_json_1.default]), 0.2, 0.4); /** @inheritdoc */ this.name = 'dictionary'; } } exports.Dictionary = Dictionary; ; /** * A Dutch first name classifier. * @private */ class FirstName extends Parsing.CoreMultiNameClassifier { /** * Creates a new first name classifier. */ constructor() { super(ds_first_name_0_json_1.default, [ { classification_score_base: 0.05, uppercase_classification_score_base: 0.15, pos_classification_score_base: 0.15, pos_possible_classification_score_base: 0.05, severity_score_base: 0.05, dataset_name: 'main', }, { classification_score_base: 0.025, uppercase_classification_score_base: 0.075, pos_classification_score_base: 0.075, pos_possible_classification_score_base: 0.025, severity_score_base: 0.025, dataset_name: 'int', } ], true); /** @inheritdoc */ this.name = 'first_name'; } } exports.FirstName = FirstName; ; /** * A Dutch family name classifier. * @private */ class FamilyName extends Parsing.CoreMultiNameClassifier { /** * Creates a new family name classifier. */ constructor() { super(merge_json([ds_family_name_0_json_1.default, ds_family_name_1_json_1.default, ds_family_name_2_json_1.default]), [ { classification_score_base: 0.05, uppercase_classification_score_base: 0.15, pos_classification_score_base: 0.15, pos_possible_classification_score_base: 0.05, severity_score_base: 0.10, dataset_name: 'main', }, { classification_score_base: 0.025, uppercase_classification_score_base: 0.075, pos_classification_score_base: 0.075, pos_possible_classification_score_base: 0.025, severity_score_base: 0.05, dataset_name: 'int', } ], true); /** @inheritdoc */ this.name = 'family_name'; } } exports.FamilyName = FamilyName; ; /** * A Dutch pet name classifier. * @private */ class PetName extends Parsing.CoreNameClassifier { /** * Creates a new pet name classifier. */ constructor() { super(ds_pet_name_0_json_1.default, 0.05, 0.10, 0.10, 0.05, 0.10); /** @inheritdoc */ this.name = 'pet_name'; } } exports.PetName = PetName; ; /** * A Dutch medicine name classifier. * @private */ class MedicineName extends Parsing.CoreNameClassifier { /** * Creates a new medicine name classifier. */ constructor() { super(ds_medicine_name_0_json_1.default, 0.10, 0.15, 0.10, 0.05, 0.20); /** @inheritdoc */ this.name = 'medicine_name'; } } exports.MedicineName = MedicineName; ; //# sourceMappingURL=names.js.map