<commit_before>'use strict';

module.exports = function(locale, options) {
  options = options || {};
  options.dictionary = options.dictionary || 'accents';

  if(typeof options.dictionary === 'string'){
    options.dictionary = dictionaries[options.dictionary];
  }

  var regexs = {};
  for (var findString in options.dictionary) {
    //don't replace characters inside html tags (between `<` and `>`)
    regexs[options.dictionary[findString]] = new RegExp('(?![^<]*>)' + escapeRegExp(findString), 'g');
  }
  for (var hash in locale) {
    for (var replacement in regexs) {
      locale[hash] = locale[hash].replace(regexs[replacement], replacement);
    }
  }
  return locale;
};

function escapeRegExp(string) {
  return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}

var dictionaries = {
  'accents': {
    'a': 'á',
    'e': 'é',
    'i': 'í',
    'o': 'ó',
    'u': 'ú'
  }
};<commit_msg>cleaner map method<commit_after>'use strict';

module.exports = function(locale, options) {
  options = options || {};
  options.dictionary = options.dictionary || 'accents';

  if(typeof options.dictionary === 'string'){
    options.dictionary = dictionaries[options.dictionary];
  }

  var regexs = regexifyDictionary(options.dictionary);
  for (var hash in locale) {
    for (var replacement in regexs) {
      locale[hash] = locale[hash].replace(regexs[replacement], replacement);
    }
  }
  return locale;
};

function regexifyDictionary(dictionary){
  var regexs = {};
  for (var entry in dictionary) {
    //don't replace characters inside html tags (between `<` and `>`)
    regexs[dictionary[entry]] = new RegExp('(?![^<]*>)' + escapeRegExp(entry), 'g');
  }
  return regexs;
}

function escapeRegExp(string) {
  return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
}

var dictionaries = {
  'accents': {
    'a': 'á',
    'e': 'é',
    'i': 'í',
    'o': 'ó',
    'u': 'ú'
  }
};
{'fraction_non_alphanumeric': 0.20545073375262055, 'fraction_numerical': 0.0010482180293501049, 'mean_word_length': 3.633495145631068, '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': '2670849', 'n_tokens_mistral': 673, 'n_tokens_neox': 647, 'n_words': 145}