<commit_before>package Sisimai::Address;
use feature ':5.10';
use strict;
use warnings;
use Class::Accessor::Lite;
use Sisimai::RFC5322;

my $Indicators = {
    'email-address' => (1 << 0),    # <<EMAIL>>
    'quoted-string' => (1 << 1),    # "Neko, Nyaan"
    'comment-block' => (1 << 2),    # (neko)
};
my $ValidEmail = qr{(?>
    (?:([^\s]+|["].+?["]))          # local part
    [@]
    (?:([^@\s]+|[0-9A-Za-z:\.]+))   # domain part
    )
}x;
my $Delimiters = { '<' => 1, '>' => 1, '(' => 1, ')' => 1, '"' => 1, ',' => 1 };
my $Undisclosed = 'libsisimai.org.invalid';
my $roaccessors = [
    'address',  # [String] Email address
    'user',     # [String] local part of the email address
    'host',     # [String] domain part of the email address
    'verp',     # [String] VERP
    'alias',    # [String] alias of the email address
];
my $rwaccessors = [
    'name',     # [String] Display name
    'comment',  # [String] (Comment)
];
Class::Accessor::Lite->mk_ro_accessors(@$roaccessors);
Class::Accessor::Lite->mk_accessors(@$rwaccessors);

sub undisclosed { 
    # Return pseudo recipient or sender address
    # @param    [String] atype  Address type: 'r' or 's'
    # @return   [String, Undef] Pseudo recipient address or sender address or
    #                           Undef when the $argv1 is neither 'r' nor 's'
    my $class = shift;
    my $atype = shift || return undef;

    return undef unless $atype =~ /\A(?:r|s)\z/;
    my $local = $atype eq 'r' ? 'recipient' : 'sender';
    return sprintf("undisclosed-%s-in-headers%s%s", $local, '@', $Undisclosed);
}

sub new {
    # Old constructor of Sisimai::Address, wrapper method of make()
    # @param        [String] email            Email address
    # @return       [Sisimai::Address, Undef] Object or Undef when the email 
    #                                         address was not valid.
    my $class = shift;
    my $email = shift // return undef;
    my $addrs = __PACKAGE__->find($email);

    return undef unless $addrs;
    return undef unless scalar @$addrs;
    return __PACKAGE__->make($addrs->[0]);
}

sub make {
    # New constructor of Sisimai::Address
    # @param    [Hash] argvs        Email address, name, and other elements
    # @return   [Sisimai::Address]  Object or Undef when the email address was
    #                               not valid.
    # @since    v4.22.1
    my $class = shift;
    my $argvs = shift // return undef;<commit_msg>Remove $Undisclosed (used only once)<commit_after>package Sisimai::Address;
use feature ':5.10';
use strict;
use warnings;
use Class::Accessor::Lite;
use Sisimai::RFC5322;

my $Indicators = {
    'email-address' => (1 << 0),    # <<EMAIL>>
    'quoted-string' => (1 << 1),    # "Neko, Nyaan"
    'comment-block' => (1 << 2),    # (neko)
};
my $ValidEmail = qr{(?>
    (?:([^\s]+|["].+?["]))          # local part
    [@]
    (?:([^@\s]+|[0-9A-Za-z:\.]+))   # domain part
    )
}x;
my $Delimiters = { '<' => 1, '>' => 1, '(' => 1, ')' => 1, '"' => 1, ',' => 1 };
my $roaccessors = [
    'address',  # [String] Email address
    'user',     # [String] local part of the email address
    'host',     # [String] domain part of the email address
    'verp',     # [String] VERP
    'alias',    # [String] alias of the email address
];
my $rwaccessors = [
    'name',     # [String] Display name
    'comment',  # [String] (Comment)
];
Class::Accessor::Lite->mk_ro_accessors(@$roaccessors);
Class::Accessor::Lite->mk_accessors(@$rwaccessors);

sub undisclosed { 
    # Return pseudo recipient or sender address
    # @param    [String] atype  Address type: 'r' or 's'
    # @return   [String, Undef] Pseudo recipient address or sender address or
    #                           Undef when the $argv1 is neither 'r' nor 's'
    my $class = shift;
    my $atype = shift || return undef;

    return undef unless $atype =~ /\A(?:r|s)\z/;
    my $local = $atype eq 'r' ? 'recipient' : 'sender';
    return sprintf("undisclosed-%s-in-headers%slibsisimai.org.invalid", $local, '@');
}

sub new {
    # Old constructor of Sisimai::Address, wrapper method of make()
    # @param        [String] email            Email address
    # @return       [Sisimai::Address, Undef] Object or Undef when the email 
    #                                         address was not valid.
    my $class = shift;
    my $email = shift // return undef;
    my $addrs = __PACKAGE__->find($email);

    return undef unless $addrs;
    return undef unless scalar @$addrs;
    return __PACKAGE__->make($addrs->[0]);
}

sub make {
    # New constructor of Sisimai::Address
    # @param    [Hash] argvs        Email address, name, and other elements
    # @return   [Sisimai::Address]  Object or Undef when the email address was
    #                               not valid.
    # @since    v4.22.1
    my $class = shift;
    my $argvs = shift // return undef;
{'fraction_non_alphanumeric': 0.16553567756528892, 'fraction_numerical': 0.011104256631708822, 'mean_word_length': 2.4693295292439372, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1269172', 'n_tokens_mistral': 1678, 'n_tokens_neox': 1619, 'n_words': 475}