<commit_before><?php

namespace Inflect;

class Inflect
{

    /**
     * Declare plural words in lowercase
     *
     * @var string
     **/
    static $plural = array(
        '/(s)$/i'                                           => '$1',
        '/^(paí)s$/i'                                       => '$1ses',
        '/(z|r)$/i'                                         => '$1es',
        '/al$/i'                                            => 'ais',
        '/el$/i'                                            => 'eis',
        '/ol$/i'                                            => 'ois',
        '/ul$/i'                                            => 'uis',
        '/([^aeou])il$/i'                                   => '$1is',
        '/m$/i'                                             => 'ns',
        '/^(japon|escoc|ingl|dinamarqu|fregu|portugu)ês$/i' => '$1eses',
        '/^(|g)ás$/i'                                       => '$1ases',
        '/ão$/i'                                            => 'ões',
        '/^(irm|m)ão$/i'                                    => '$1ãos',
        '/^(alem|c|p)ão$/i'                                 => '$1ães',
        '/ao$/i'                                            => 'oes',
        '/^(irm|m)ao$/i'                                    => '\1aos',
        '/^(alem|c|p)ao$/i'                                 => '\1aes',
        '/$/'                                               => 's',
    );

    /**
     * Declare singular words in lowercase
     *
     * @var string
     **/
    static $singular = array(
        '/([^ê])s$/i'                                        => '$1',
        '/^(á|gá|paí)s$/i'                                   => '$1s',
        '/(r|z)es$/i'                                        => '$1',
        '/([^p])ais$/i'                                      => '$1al',
        '/eis$/i'                                            => 'el',
        '/ois$/i'                                            => 'ol',
        '/uis$/i'                                            => 'ul',
        '/(r|t|f|v)is$/i'                                    => '$1il',
        '/ns$/i'                                             => 'm',
        '/sses$/i'                                           => 'sse',
        '/^(.*[^s]s)es$/i'                                   => '$1',
        '/ães$/i'                                            => 'ão',
        '/aes$/i'                                            => 'ao',
        '/ãos$/i'                                            => 'ão',
        '/aos$/i'                                            => 'ao',
        '/ões$/i'                                            => 'ão',
        '/oes$/i'                                            => 'ao',
        '/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i' => '$1ês',
        '/^(g|)ases$/i'                                      => '$1ás'
    );

    /**
     * Declare irregular word
     *
     * @var string
     **/
    static $irregular = array(
        'país' => 'países'
    );

    /**
     * Declare uncountable words
     *
     * @var string
     **/
    static $uncountable = array(
        'tórax',
        'tênis',
        'ônibus',
        'lápis',
        'fênix'
    );

    /**
     * Pluralize word
     *
     * @param string
     * @return string
     **/
    public static function pluralize($word)
    {

    }

    /**
     * Singularize word
     *
     * @param string
     * @return string
     **/
    public static function singularize($word)
    {

    }<commit_msg>Add handle to singularize method<commit_after><?php

namespace Inflect;

class Inflect
{

    /**
     * Declare plural words in lowercase
     *
     * @var string
     **/
    static $plural = array(
        '/(s)$/i'                                           => '$1',
        '/^(paí)s$/i'                                       => '$1ses',
        '/(z|r)$/i'                                         => '$1es',
        '/al$/i'                                            => 'ais',
        '/el$/i'                                            => 'eis',
        '/ol$/i'                                            => 'ois',
        '/ul$/i'                                            => 'uis',
        '/([^aeou])il$/i'                                   => '$1is',
        '/m$/i'                                             => 'ns',
        '/^(japon|escoc|ingl|dinamarqu|fregu|portugu)ês$/i' => '$1eses',
        '/^(|g)ás$/i'                                       => '$1ases',
        '/ão$/i'                                            => 'ões',
        '/^(irm|m)ão$/i'                                    => '$1ãos',
        '/^(alem|c|p)ão$/i'                                 => '$1ães',
        '/ao$/i'                                            => 'oes',
        '/^(irm|m)ao$/i'                                    => '\1aos',
        '/^(alem|c|p)ao$/i'                                 => '\1aes',
        '/$/'                                               => 's',
    );

    /**
     * Declare singular words in lowercase
     *
     * @var string
     **/
    static $singular = array(
        '/([^ê])s$/i'                                        => '$1',
        '/^(á|gá|paí)s$/i'                                   => '$1s',
        '/(r|z)es$/i'                                        => '$1',
        '/([^p])ais$/i'                                      => '$1al',
        '/eis$/i'                                            => 'el',
        '/ois$/i'                                            => 'ol',
        '/uis$/i'                                            => 'ul',
        '/(r|t|f|v)is$/i'                                    => '$1il',
        '/ns$/i'                                             => 'm',
        '/sses$/i'                                           => 'sse',
        '/^(.*[^s]s)es$/i'                                   => '$1',
        '/ães$/i'                                            => 'ão',
        '/aes$/i'                                            => 'ao',
        '/ãos$/i'                                            => 'ão',
        '/aos$/i'                                            => 'ao',
        '/ões$/i'                                            => 'ão',
        '/oes$/i'                                            => 'ao',
        '/(japon|escoc|ingl|dinamarqu|fregu|portugu)eses$/i' => '$1ês',
        '/^(g|)ases$/i'                                      => '$1ás'
    );

    /**
     * Declare irregular word
     *
     * @var string
     **/
    static $irregular = array(
        'país' => 'países'
    );

    /**
     * Declare uncountable words
     *
     * @var string
     **/
    static $uncountable = array(
        'tórax',
        'tênis',
        'ônibus',
        'lápis',
        'fênix'
    );

    /**
     * Pluralize word
     *
     * @param string
     * @return string
     **/
    public static function pluralize($word)
    {

    }

    /**
     * Singularize word
     *
     * @param string
     * @return string
     **/
    public static function singularize($word)
    {
        if(in_array(strtolower($word), self::uncountable))
            return $word;

        foreach (self::$irregular as $result => $pattern)
        {
            $pattern = '/' . $pattern . '$/i';

            if(preg_match($pattern, $word))
                return preg_replace($pattern, $result, $word)
        }

        foreach(self::$singular as $pattern => $result)
        {
            if(preg_match($pattern, $word))
                return preg_replace($pattern, $result, $word)
        }

        return $word;
    }
{'fraction_non_alphanumeric': 0.16466753585397653, 'fraction_numerical': 0.00469361147327249, 'mean_word_length': 0.6135885570046277, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 124, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4976050', 'n_tokens_mistral': 2076, 'n_tokens_neox': 1932, 'n_words': 316}