<commit_before><?php

namespace Tdd;

class NumberNames
{
    protected $unique = array(
        'zero',
        'one',
        'two',
        'three',
        'four',
        'five',
        'six',
        'seven',
        'eight',
        'nine',
        'ten',
        'eleven',
        'twelve',
        'thirteen',
        'fourteen',
        'fifteen',
        'sixteen',
        'seventeen',
        'eighteen',
        'nineteen',
        'twenty',
        30 => 'thirty',
        40 => 'forty',
        50 => 'fifty',
        60 => 'sixty',
        70 => 'seventy',
        80 => 'eighty',
        90 => 'ninety'
    );

    protected $units = array(
        2 => 'thousand',
        3 => 'million'
    );

    /**
     * Converts an integer to its English language equivalent.
     *
     * Example: 310 would become three hundred and ten.
     *
     * @param  int    $integer Integer to convert
     * @return string English language equivalent of provided integer
     */
    public function convert($integer)
    {
        if ($integer == 0) {
            return 'zero';
        }

        $name = array();
        $numbers = explode(',', number_format($integer));
        $count = count($numbers);

        foreach ($numbers as $number) {
            $padded = sprintf('%03d', $number);

            $temp = $this->getHundreds($padded);
            $temp .= $this->getTens(substr($padded, 1));

            if ($count > 1) {
                $temp .= ' ' . $this->units[$count];
            }

            $count--;

            if ($temp) {
                $name[] = $temp;
            }
        }

        return implode(', ', $name);
    }

    protected function getHundreds($hundreds)
    {
        $string = null;

        if ($hundreds[0]) {
            $string = $this->unique[$hundreds[0]] . ' hundred';
        }

        if ($string && ltrim(substr($hundreds, 1), '0')) {
            $string .= ' and ';
        }

        return $string;
    }

    public function getTens($tens)
    {
        if (array_key_exists($tens, $this->unique)) {
            return $this->unique[$tens];
        }

        $temp = null;

        if ($tens[0] > 0) {
            $temp .= $this->unique[$tens[0] * 10] . ' ';
        }

        if ($tens[1] > 0) {
            $temp .= $this->unique[$tens[1]];
        }

        return $temp;
    }

}<commit_msg>Changes 'unique' to 'dictionary'.<commit_after><?php

namespace Tdd;

class NumberNames
{
    protected $dictionary = array(
        'zero',
        'one',
        'two',
        'three',
        'four',
        'five',
        'six',
        'seven',
        'eight',
        'nine',
        'ten',
        'eleven',
        'twelve',
        'thirteen',
        'fourteen',
        'fifteen',
        'sixteen',
        'seventeen',
        'eighteen',
        'nineteen',
        'twenty',
        30 => 'thirty',
        40 => 'forty',
        50 => 'fifty',
        60 => 'sixty',
        70 => 'seventy',
        80 => 'eighty',
        90 => 'ninety'
    );

    protected $units = array(
        2 => 'thousand',
        3 => 'million'
    );

    /**
     * Converts an integer to its English language equivalent.
     *
     * Example: 310 would become three hundred and ten.
     *
     * @param  int    $integer Integer to convert
     * @return string English language equivalent of provided integer
     */
    public function convert($integer)
    {
        if ($integer == 0) {
            return 'zero';
        }

        $name = array();
        $numbers = explode(',', number_format($integer));
        $count = count($numbers);

        foreach ($numbers as $number) {
            $padded = sprintf('%03d', $number);

            $temp = $this->getHundreds($padded);
            $temp .= $this->getTens(substr($padded, 1));

            if ($count > 1) {
                $temp .= ' ' . $this->units[$count];
            }

            $count--;

            if ($temp) {
                $name[] = $temp;
            }
        }

        return implode(', ', $name);
    }

    protected function getHundreds($hundreds)
    {
        $string = null;

        if ($hundreds[0]) {
            $string = $this->dictionary[$hundreds[0]] . ' hundred';
        }

        if ($string && ltrim(substr($hundreds, 1), '0')) {
            $string .= ' and ';
        }

        return $string;
    }

    public function getTens($tens)
    {
        if (array_key_exists($tens, $this->dictionary)) {
            return $this->dictionary[$tens];
        }

        $temp = null;

        if ($tens[0] > 0) {
            $temp .= $this->dictionary[$tens[0] * 10] . ' ';
        }

        if ($tens[1] > 0) {
            $temp .= $this->dictionary[$tens[1]];
        }

        return $temp;
    }

}
{'fraction_non_alphanumeric': 0.16198658843252306, 'fraction_numerical': 0.015088013411567477, 'mean_word_length': 1.3972877950778504, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '635921', 'n_tokens_mistral': 1549, 'n_tokens_neox': 1438, 'n_words': 327}