<commit_before>var _ = require('lodash'),
    memoizeSync = require('memoizesync'),
    esmangle = require('esmangle'),
    esanimate = require('esanimate'),
    escodegen = require('escodegen'),
    estraverse = require('estraverse'),
    replaceDescendantNode = require('assetgraph/lib/replaceDescendantNode'),
    i18nTools = {};

 // Replace - with _ and convert to lower case: en-GB => en_gb
i18nTools.normalizeLocaleId = function (localeId) {
    return localeId && localeId.replace(/-/g, '_').toLowerCase();
};

// Helper for getting a prioritized list of relevant locale ids from a specific locale id.
// For instance, "en_US" produces ["en_US", "en"]<commit_msg>Copy in the replaceDescendantNode function from assetgraph.<commit_after>var _ = require('lodash'),
    memoizeSync = require('memoizesync'),
    esmangle = require('esmangle'),
    esanimate = require('esanimate'),
    escodegen = require('escodegen'),
    estraverse = require('estraverse'),
    i18nTools = {};

function replaceDescendantNode(ancestorNode, oldNode, newNode) {
    estraverse.replace(ancestorNode, {
        enter: function (node) {
            if (node === oldNode) {
                this.break();
                return newNode;
            }
        }
    });
    return newNode;
};

 // Replace - with _ and convert to lower case: en-GB => en_gb
i18nTools.normalizeLocaleId = function (localeId) {
    return localeId && localeId.replace(/-/g, '_').toLowerCase();
};

// Helper for getting a prioritized list of relevant locale ids from a specific locale id.
// For instance, "en_US" produces ["en_US", "en"]
{'fraction_non_alphanumeric': 0.13420724094881398, 'fraction_numerical': 0.004993757802746567, 'mean_word_length': 3.4901960784313726, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3777953', 'n_tokens_mistral': 484, 'n_tokens_neox': 475, 'n_words': 123}