<commit_before>class Any is also {
    our Int multi method bytes() is export {
        Q:PIR {
            $S0 = self
            $I0 = bytelength $S0
            %r = box $I0
        }
    }

    our Str multi method capitalize() is export {
        self.lc.subst(/\w+/, { .ucfirst }, :global)
    }

    our Str multi method chop() is export {
        self.substr(0, -1)
    }

    our Str multi method fmt(Str $format = '%s') {
        sprintf($format, self)
    }

    our Str multi method lc() is export {
        Q:PIR {
            $S0 = self
            downcase $S0
            %r = box $S0
        }
    }

    our Str multi method lcfirst() is export {
        self gt '' ?? self.substr(0,1).lc ~ self.substr(1) !! ""
    }

    our Int multi method ord() is export {
        Q:PIR {
            $S0 = self
            $I0 = ord $S0
            %r = box $I0
        }
    }

    our Int multi method p5chomp() is export {
        my $num = 0;

        for @.list -> $str is rw {
            if $str ~~ /\x0a$/ {
                $str = $str.substr(0, $str.chars - 1);
                $num++;
            }
        }

        $num;
    }

    # TODO: Return type should be a Char once that is supported.
    our Str multi method p5chop() is export {
        my $char = '';

        for @.list -> $str is rw {
            if $str gt '' {
                $char = $str.substr($str.chars - 1, 1);
                $str  = $str.chop;
            }
        }

        $char
    }

    our Str multi method samecase(Str $pattern) is export {
        my @pattern = $pattern.split('');
        [~] gather {
            my $p = "";
            for (~self).split('') -> $s {
                $p = @pattern.shift if @pattern;
                given $p {
                    when /<upper>/ { take $s.uc }
                    when /<lower>/ { take $s.lc }
                    default { take $s }
                }
            }
        }
    }

=begin pod

=head2 split

 our List multi Str::split ( Str $delimiter ,  Str $input = $+_, Int $limit = inf )
 our List multi Str::split ( Rule $delimiter = /\s+/,  Str $input = $+_, Int $limit = inf )
 our List multi Str::split ( Str $input :  Str $delimiter          , Int $limit = inf )
 our List multi Str::split ( Str $input : Rule $delimiter          , Int $limit = inf )

String delimiters must not be treated as rules but as constants.  The
default is no longer S<' '> since that would be interpreted as a constant.
P5's C<< split('S< >') >> will translate to C<.words> or some such.  Null trailing fields
are no longer trimmed by default.  We might add some kind of :trim flag or
introduce a trimlist function of some sort.

B<Note:> partial implementation only

=end pod
<commit_msg>make POD consistent<commit_after>class Any is also {
    our Int multi method bytes() is export {
        Q:PIR {
            $S0 = self
            $I0 = bytelength $S0
            %r = box $I0
        }
    }

    our Str multi method capitalize() is export {
        self.lc.subst(/\w+/, { .ucfirst }, :global)
    }

    our Str multi method chop() is export {
        self.substr(0, -1)
    }

    our Str multi method fmt(Str $format = '%s') {
        sprintf($format, self)
    }

    our Str multi method lc() is export {
        Q:PIR {
            $S0 = self
            downcase $S0
            %r = box $S0
        }
    }

    our Str multi method lcfirst() is export {
        self gt '' ?? self.substr(0,1).lc ~ self.substr(1) !! ""
    }

    our Int multi method ord() is export {
        Q:PIR {
            $S0 = self
            $I0 = ord $S0
            %r = box $I0
        }
    }

    our Int multi method p5chomp() is export {
        my $num = 0;

        for @.list -> $str is rw {
            if $str ~~ /\x0a$/ {
                $str = $str.substr(0, $str.chars - 1);
                $num++;
            }
        }

        $num;
    }

    # TODO: Return type should be a Char once that is supported.
    our Str multi method p5chop() is export {
        my $char = '';

        for @.list -> $str is rw {
            if $str gt '' {
                $char = $str.substr($str.chars - 1, 1);
                $str  = $str.chop;
            }
        }

        $char
    }

    our Str multi method samecase(Str $pattern) is export {
        my @pattern = $pattern.split('');
        [~] gather {
            my $p = "";
            for (~self).split('') -> $s {
                $p = @pattern.shift if @pattern;
                given $p {
                    when /<upper>/ { take $s.uc }
                    when /<lower>/ { take $s.lc }
                    default { take $s }
                }
            }
        }
    }

=begin item split

 our List multi Str::split ( Str $delimiter ,  Str $input = $+_, Int $limit = inf )
 our List multi Str::split ( Rule $delimiter = /\s+/,  Str $input = $+_, Int $limit = inf )
 our List multi Str::split ( Str $input :  Str $delimiter          , Int $limit = inf )
 our List multi Str::split ( Str $input : Rule $delimiter          , Int $limit = inf )

String delimiters must not be treated as rules but as constants.  The
default is no longer S<' '> since that would be interpreted as a constant.
P5's C<< split('S< >') >> will translate to C<.words> or some such.  Null trailing fields
are no longer trimmed by default.  We might add some kind of :trim flag or
introduce a trimlist function of some sort.

B<Note:> partial implementation only

=end item

{'fraction_non_alphanumeric': 0.12248260710362505, 'fraction_numerical': 0.009337239106554375, 'mean_word_length': 1.4508748317631224, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 25, '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': '80191', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1662, 'n_words': 597}