<commit_before><?php

namespace Awesomite\Chariot\Pattern;

use Awesomite\Chariot\Exceptions\InvalidArgumentException;
use Awesomite\Chariot\Exceptions\LogicException;
use Awesomite\Chariot\Pattern\StdPatterns\DatePattern;
use Awesomite\Chariot\Pattern\StdPatterns\IntPattern;
use Awesomite\Chariot\Pattern\StdPatterns\RegexPattern;
use Awesomite\Chariot\Pattern\StdPatterns\UnsignedIntPattern;

class Patterns implements PatternsInterface
{
    const REGEX_INT = '(-?[1-9][0-9]*)|0';
    const REGEX_UINT = '([1-9][0-9]*)|0';
    const REGEX_ALPHANUM = '[a-zA-Z0-9]+';
    const REGEX_DATE = '[0-9]{4}-[0-9]{2}-[0-9]{2}';
    const REGEX_DEFAULT = '[^/]+';

    const STANDARD_PATTERNS
        = [
            ':int'      => IntPattern::class,
            ':uint'     => UnsignedIntPattern::class,
            ':date'     => DatePattern::class,
            ':alphanum' => self::REGEX_ALPHANUM,
        ];

    private $patterns = [];

    private $defaultPattern;

    public function __construct(array $patterns = [], string $defaultPattern = null)
    {
        foreach ($patterns as $name => $pattern) {
            if (is_array($pattern)) {
                $this->addEnumPattern($name, $pattern);
            } else {
                $this->addPattern($name, $pattern);<commit_msg>Added :list to set of default patterns<commit_after><?php

namespace Awesomite\Chariot\Pattern;

use Awesomite\Chariot\Exceptions\InvalidArgumentException;
use Awesomite\Chariot\Exceptions\LogicException;
use Awesomite\Chariot\Pattern\StdPatterns\DatePattern;
use Awesomite\Chariot\Pattern\StdPatterns\IntPattern;
use Awesomite\Chariot\Pattern\StdPatterns\ListPattern;
use Awesomite\Chariot\Pattern\StdPatterns\RegexPattern;
use Awesomite\Chariot\Pattern\StdPatterns\UnsignedIntPattern;

class Patterns implements PatternsInterface
{
    const REGEX_INT = '(-?[1-9][0-9]*)|0';
    const REGEX_UINT = '([1-9][0-9]*)|0';
    const REGEX_ALPHANUM = '[a-zA-Z0-9]+';
    const REGEX_DATE = '[0-9]{4}-[0-9]{2}-[0-9]{2}';
    const REGEX_DEFAULT = '[^/]+';

    const STANDARD_PATTERNS
        = [
            ':int'      => IntPattern::class,
            ':uint'     => UnsignedIntPattern::class,
            ':date'     => DatePattern::class,
            ':list'     => ListPattern::class,
            ':alphanum' => self::REGEX_ALPHANUM,
        ];

    private $patterns = [];

    private $defaultPattern;

    public function __construct(array $patterns = [], string $defaultPattern = null)
    {
        foreach ($patterns as $name => $pattern) {
            if (is_array($pattern)) {
                $this->addEnumPattern($name, $pattern);
            } else {
                $this->addPattern($name, $pattern);
{'fraction_non_alphanumeric': 0.14894405335309374, 'fraction_numerical': 0.015561319007039644, 'mean_word_length': 3.0419161676646707, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '4087357', 'n_tokens_mistral': 929, 'n_tokens_neox': 903, 'n_words': 141}