<commit_before>var format = require('util').format,
  fs = require('fs'),
  _ = require('underscore'),
  lang = 'default',
  compile;

var i18n = function(){
  var store = {};

  this.get = function(){
    var args = _.toArray(arguments),
      str = args.shift(),
      split = str.split('.'),
      cursor = store;

    for (var i=0, len=split.length; i<len; i++){
      var item = split[i];
      cursor = cursor[item];
    }

    args.unshift(cursor);
    if (cursor) return format.apply(null, args);
  };

  this.set = function(str, val){
    var split = str.split('.'),
      cursor = store;

    for (var i=0, len=split.length - 1; i<len; i++){
      var item = split[i];
      cursor = cursor[item] = cursor[item] || {};
    }

    cursor[split[i]] = val;
  };<commit_msg>i18n: plural<commit_after>var format = require('util').format,
  fs = require('fs'),
  _ = require('underscore'),
  lang = 'default',
  compile;

var i18n = function(){
  var store = {};

  this.get = function(){
    var args = _.toArray(arguments),
      str = args.shift(),
      split = str.split('.'),
      cursor = store;

    for (var i=0, len=split.length; i<len; i++){
      var item = split[i];
      cursor = cursor[item];
    }

    if (_.isArray(cursor)){
      var number = args.shift();

      if (cursor.length === 3){
        if (number > 1) cursor = cursor[2];
        else if (number === 0) cursor = cursor[0];
        else cursor = cursor[1];
      } else {
        if (number > 1) cursor = cursor[1];
        else cursor = cursor[0];
      }

      if (cursor.match(/%[ds]/)) args.unshift(number);
    }

    args.unshift(cursor);
    return format.apply(null, args);
  };

  this.set = function(str, val){
    var split = str.split('.'),
      cursor = store;

    for (var i=0, len=split.length - 1; i<len; i++){
      var item = split[i];
      cursor = cursor[item] = cursor[item] || {};
    }

    cursor[split[i]] = val;
  };
{'fraction_non_alphanumeric': 0.18633540372670807, 'fraction_numerical': 0.010869565217391304, 'mean_word_length': 2.403169014084507, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4385102', 'n_tokens_mistral': 675, 'n_tokens_neox': 649, 'n_words': 163}