<commit_before>use v6;
use Nightscape::Types;
use TXN::Parser;
use TXN::Parser::Types;
unit module Nightscape::Config::Utils;

# sub gen-asset-code {{{

sub gen-asset-code(Str:D $s where *.so) is export returns AssetCode:D
{
    my AssetCode:D $asset-code = $s;
}

# end sub gen-asset-code }}}
# sub gen-costing {{{

sub gen-costing(Str:D $s where *.so) is export returns Costing:D
{
    my Costing:D $costing = ::($s.uc);
}

# end sub gen-costing }}}
# sub gen-date {{{

sub gen-date(Str:D $d where *.so) is export returns Date:D
{
    my TXN::Parser::Actions:D $actions .= new;
    my Date:D $date =
        TXN::Parser::Grammar.parse($d, :rule<date:full-date>, :$actions).made;
}

# end sub gen-date }}}
# sub gen-date-range {{{

multi sub gen-date-range(Str:D $s where *.so) is export returns Range:D
{
    my Str:D ($d1, $elipsis, $d2) = $s.split(' ');
    my Range:D $date-range = gen-date-range($d1, $d2);
}

multi sub gen-date-range('*', '*') returns Range:D
{
    my Range:D $date-range = * .. *;
}

multi sub gen-date-range(
    '*',
    Str:D $d2 where { TXN::Parser::Grammar.parse($_, :rule<date:full-date>) }
) returns Range:D<commit_msg>split date range strings on elipsis<commit_after>use v6;
use Nightscape::Types;
use TXN::Parser;
use TXN::Parser::Types;
unit module Nightscape::Config::Utils;

# sub gen-asset-code {{{

sub gen-asset-code(Str:D $s where *.so) is export returns AssetCode:D
{
    my AssetCode:D $asset-code = $s;
}

# end sub gen-asset-code }}}
# sub gen-costing {{{

sub gen-costing(Str:D $s where *.so) is export returns Costing:D
{
    my Costing:D $costing = ::($s.uc);
}

# end sub gen-costing }}}
# sub gen-date {{{

sub gen-date(Str:D $d where *.so) is export returns Date:D
{
    my TXN::Parser::Actions:D $actions .= new;
    my Date:D $date =
        TXN::Parser::Grammar.parse($d, :rule<date:full-date>, :$actions).made;
}

# end sub gen-date }}}
# sub gen-date-range {{{

multi sub gen-date-range(Str:D $s where *.so) is export returns Range:D
{
    my Str:D ($d1, $d2) = $s.split('..');
    my Range:D $date-range = gen-date-range($d1, $d2);
}

multi sub gen-date-range('*', '*') returns Range:D
{
    my Range:D $date-range = * .. *;
}

multi sub gen-date-range(
    '*',
    Str:D $d2 where { TXN::Parser::Grammar.parse($_, :rule<date:full-date>) }
) returns Range:D
{'fraction_non_alphanumeric': 0.19438444924406048, 'fraction_numerical': 0.005183585313174946, 'mean_word_length': 3.688259109311741, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3603221', 'n_tokens_mistral': 929, 'n_tokens_neox': 914, 'n_words': 227}