<commit_before>"use strict";
const _ = require("lodash");
const slugify = require('transliteration').slugify;
const judgeModel = require("./../input/judge");
const homonyms = [
    "<NAME>",
    "<NAME>"
];

function transliterateName(name) {
    return slugify(name, { lowercase: true, separator: '_', replace:  [["'", ''], ['"', ''], [';', ''], ['/', ''], ['’', '']]});
}

/**
 *
 * @param {Array} judges
 * @returns {Array}
 */
module.exports = function transliterateNames(judges) {
    console.log('transliterateNames');
    judges.forEach(function (judge) {
        if (!_.includes(homonyms, _.toLower(judge[judgeModel.name]))) {
            judge.key = _.toLower(transliterateName(judge[judgeModel.name]));
        } else {
            judge.key = _.toLower(transliterateName(judge[judgeModel.name] + " " + judge[judgeModel.region]));
        }
    });
    return judges;<commit_msg>homonyms could by in same region –≥ extend key by department #67<commit_after>"use strict";
const _ = require("lodash");
const slugify = require('transliteration').slugify;
const judgeModel = require("./../input/judge");
const homonyms = [
    "<NAME>",
    "<NAME>"
];

function transliterateName(name) {
    return slugify(name, { lowercase: true, separator: '_', replace:  [["'", ''], ['"', ''], [';', ''], ['/', ''], ['’', '']]});
}

/**
 *
 * @param {Array} judges
 * @returns {Array}
 */
module.exports = function transliterateNames(judges) {
    console.log('transliterateNames');
    judges.forEach(function (judge) {
        if (!_.includes(homonyms, _.toLower(judge[judgeModel.name]))) {
            judge.key = _.toLower(transliterateName(judge[judgeModel.name]));
        } else {
            judge.key = _.toLower(transliterateName(judge[judgeModel.name] + " " + judge[judgeModel.department]));
        }
    });
    return judges;
{'fraction_non_alphanumeric': 0.20567375886524822, 'fraction_numerical': 0.0010911074740861974, 'mean_word_length': 3.7025641025641027, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4213924', 'n_tokens_mistral': 607, 'n_tokens_neox': 583, 'n_words': 98}