<commit_before>//  Underscore.inflection.js
//  (c) 2011 <NAME>
//  Underscore.inflection is freely distributable under the MIT license.
//  Portions of Underscore.inflection are inspired or borrowed from ActiveSupport
//  Version 1.0.0

( function( _, undefined )
{
  var
    plurals = [ ],

    singulars = [ ],

    uncountables = [ ];

  /**
   * Inflector
   */
  var inflector = {

    gsub : function( word, rule, replacement )
    {
      var pattern = new RegExp( rule.source || rule, 'gi' );

      return pattern.test( word ) ? word.replace( pattern, replacement ) : null;
    },

    plural : function( rule, replacement )
    {
      plurals.unshift( [ rule, replacement ] );
    },

    pluralize : function( word, count, includeNumber )
    {
      var result;

      if( count !== undefined )
      {
        count = Math.round(count);
        result = ( count === 1 ) ? this.singularize( word ) : this.pluralize( word );
        result = ( includeNumber ) ? [ count, result ].join( ' ' ) : result;
      }
      else
      {
        if( _( uncountables ).include( word ) )
        {
          return word;
        }

        result = word;

        _( plurals ).detect( function( rule )
        {
          var gsub = this.gsub( word, rule[ 0 ], rule[ 1 ] );

          return gsub ? ( result = gsub ) : false;
        },
        this );
      }

      return result;
    },

    singular : function( rule, replacement )
    {
      singulars.unshift( [ rule, replacement ] );
    },

    singularize : function( word )
    {
      if( _( uncountables ).include( word ) )
      {
        return word;
      }

      var result = word;

      _( singulars ).detect( function( rule )
      {
        var gsub = this.gsub( word, rule[ 0 ], rule[ 1 ] );

        return gsub ? ( result = gsub ) : false;
      },
      this );

      return result;
    },

    irregular : function( singular, plural )
    {
      this.plural( '\\b' + singular + '\\b', plural );
      this.singular( '\\b' + plural + '\\b', singular );
    },

    uncountable : function( word )
    {
      uncountables.unshift( word );
    },

    ordinalize : function( word )
    {
      if ( isNaN( word ) )
        return word;

      word = word.toString();
      var lastDigit = word.slice(-1);
      var lastTwoDigits = word.slice(-2);

      if ( lastTwoDigits === "11" || lastTwoDigits === "12" || lastTwoDigits === "13" )
        return word + "th";

      switch ( lastDigit ) {
        case "1":
          return word + "st";
        case "2":
          return word + "nd";
        case "3":
          return word + "rd";
        default:
          return word + "th";
      }
    },

    resetInflections : function( )
    {
      plurals      = [ ];
      singulars    = [ ];
      uncountables = [ ];

      this.plural( /$/,                         's'       );
      this.plural( /s$/,                        's'       );
      this.plural( /(ax|test)is$/,              '$1es'    );
      this.plural( /(octop|vir)us$/,            '$1i'     );
      this.plural( /(octop|vir)i$/,             '$1i'     );
      this.plural( /(alias|status)$/,           '$1es'    );
      this.plural( /(bu)s$/,                    '$1ses'   );<commit_msg>Changed the signature of ordinalize<commit_after>//  Underscore.inflection.js
//  (c) 2011 <NAME>
//  Underscore.inflection is freely distributable under the MIT license.
//  Portions of Underscore.inflection are inspired or borrowed from ActiveSupport
//  Version 1.0.0

( function( _, undefined )
{
  var
    plurals = [ ],

    singulars = [ ],

    uncountables = [ ];

  /**
   * Inflector
   */
  var inflector = {

    gsub : function( word, rule, replacement )
    {
      var pattern = new RegExp( rule.source || rule, 'gi' );

      return pattern.test( word ) ? word.replace( pattern, replacement ) : null;
    },

    plural : function( rule, replacement )
    {
      plurals.unshift( [ rule, replacement ] );
    },

    pluralize : function( word, count, includeNumber )
    {
      var result;

      if( count !== undefined )
      {
        count = Math.round(count);
        result = ( count === 1 ) ? this.singularize( word ) : this.pluralize( word );
        result = ( includeNumber ) ? [ count, result ].join( ' ' ) : result;
      }
      else
      {
        if( _( uncountables ).include( word ) )
        {
          return word;
        }

        result = word;

        _( plurals ).detect( function( rule )
        {
          var gsub = this.gsub( word, rule[ 0 ], rule[ 1 ] );

          return gsub ? ( result = gsub ) : false;
        },
        this );
      }

      return result;
    },

    singular : function( rule, replacement )
    {
      singulars.unshift( [ rule, replacement ] );
    },

    singularize : function( word )
    {
      if( _( uncountables ).include( word ) )
      {
        return word;
      }

      var result = word;

      _( singulars ).detect( function( rule )
      {
        var gsub = this.gsub( word, rule[ 0 ], rule[ 1 ] );

        return gsub ? ( result = gsub ) : false;
      },
      this );

      return result;
    },

    irregular : function( singular, plural )
    {
      this.plural( '\\b' + singular + '\\b', plural );
      this.singular( '\\b' + plural + '\\b', singular );
    },

    uncountable : function( word )
    {
      uncountables.unshift( word );
    },

    ordinalize : function( number )
    {
      if ( isNaN( number ) )
        return number;

      number = number.toString();
      var lastDigit = number.slice(-1);
      var lastTwoDigits = number.slice(-2);

      if ( lastTwoDigits === "11" || lastTwoDigits === "12" || lastTwoDigits === "13" )
        return number + "th";

      switch ( lastDigit ) {
        case "1":
          return number + "st";
        case "2":
          return number + "nd";
        case "3":
          return number + "rd";
        default:
          return number + "th";
      }
    },

    resetInflections : function( )
    {
      plurals      = [ ];
      singulars    = [ ];
      uncountables = [ ];

      this.plural( /$/,                         's'       );
      this.plural( /s$/,                        's'       );
      this.plural( /(ax|test)is$/,              '$1es'    );
      this.plural( /(octop|vir)us$/,            '$1i'     );
      this.plural( /(octop|vir)i$/,             '$1i'     );
      this.plural( /(alias|status)$/,           '$1es'    );
      this.plural( /(bu)s$/,                    '$1ses'   );
{'fraction_non_alphanumeric': 0.147239263803681, 'fraction_numerical': 0.008588957055214725, 'mean_word_length': 1.5482610394685423, 'pattern_counts': {'":': 6, '<': 5, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4413135', 'n_tokens_mistral': 2095, 'n_tokens_neox': 2007, 'n_words': 490}