...
 
Commits (9)
Revision history for Perl CPAN module Lingua::En::NameParse
1.37 18 Aug 2018
Allow case_all_reverse to work with name type of 'John' (thanks to Hugh S. Myers for reporting this)
Fixed github issue for EdwardsMike, 2 letter surname not correctly parsed
Renamed github repo to HumanNameParser
1.36 15 Jul 2016
Added religious title Rev (for Reverand RT bug #116080
......
......@@ -39,11 +39,11 @@
"provides" : {
"Lingua::EN::NameParse" : {
"file" : "lib/Lingua/EN/NameParse.pm",
"version" : "1.36"
"version" : "1.37"
},
"Lingua::EN::NameParse::Grammar" : {
"file" : "lib/Lingua/EN/NameParse/Grammar.pm",
"version" : "1.36"
"version" : "1.37"
}
},
"release_status" : "stable",
......@@ -55,6 +55,6 @@
"url" : "https://github.com/kimryan/Lingua-EN-NameParse"
}
},
"version" : "1.36",
"version" : "1.37",
"x_serialization_backend" : "JSON::PP version 2.27300"
}
......@@ -17,10 +17,10 @@ name: Lingua-EN-NameParse
provides:
Lingua::EN::NameParse:
file: lib/Lingua/EN/NameParse.pm
version: '1.36'
version: '1.37'
Lingua::EN::NameParse::Grammar:
file: lib/Lingua/EN/NameParse/Grammar.pm
version: '1.36'
version: '1.37'
requires:
Parse::RecDescent: '1'
Test::Pod::Coverage: '1.04'
......@@ -31,5 +31,5 @@ requires:
resources:
license: http://dev.perl.org/licenses/
repository: https://github.com/kimryan/Lingua-EN-NameParse
version: '1.36'
version: '1.37'
x_serialization_backend: 'CPAN::Meta::YAML version 0.016'
NAME
Lingua::EN::NameParse - extract the components of a person or couples full name, presented as a text string
Lingua::EN::NameParse - extract the components of a person or couples full name, from free form text
SYNOPSIS
......@@ -10,7 +10,6 @@ SYNOPSIS
my %args =
(
auto_clean => 1,
force_case => 1,
lc_prefix => 1,
initials => 3,
allow_reversed => 1,
......@@ -18,34 +17,57 @@ SYNOPSIS
extended_titles => 0
);
my $name = Lingua::EN::NameParse->new(%args);
$error = $name->parse("MR AC DE SILVA");
%name_comps = $name->components;
$surname = $name_comps{surname_1}; # De Silva
$correct_casing = $name->case_all; # Mr AC de Silva
$correct_casing = $name->case_all_reversed ; # de Silva, AC
my $name = Lingua::EN::NameParse->new(%args);
$error = $name->parse("Estate Of Lt Col AB Van Der Heiden (Hold Mail)");
unless ( $error )
{
print($name->report);
Case all : Estate Of Lt Col AB Van Der Heiden (Hold Mail)
Case all reversed : Van Der Heiden, Lt Col AB
Salutation : Dear Friend
Type : Mr_A_Smith
Parsing Error : 0
Error description : :
Parsing Warning : 1
Warning description : ;non_matching text found : (Hold Mail)
COMPONENTS
initials_1 : AB
non_matching : (Hold Mail)
precursor : Estate Of
surname_1 : Van Der Heiden
title_1 : Lt Col
%name_comps = $name->components;
$surname = $name_comps{surname_1};
$good_name = &clean("Bad Na9me "); # "Bad Name"
$salutation = $name->salutation(salutation => 'Dear',sal_default => 'Friend')); # Dear Mr de Silva
$correct_casing = $name->case_all;
%my_properties = $name->properties;
$number_surnames = $my_properties{number}; # 1
$bad_input = $my_properties{non_matching};
$correct_casing = $name->case_all_reversed ;
$name->report; # create a report listing all information about the parsed name
$salutation = $name->salutation(salutation => 'Dear',sal_default => 'Friend'));
$good_name = clean("Bad Na9me "); # "Bad Name"
%my_properties = $name->properties;
$number_surnames = $my_properties{number}; # 1
}
$lc_prefix = 0;
$correct_case = &case_surname("DE SILVA-MACNAY",$lc_prefix); # De Silva-MacNay
$correct_case = case_surname("DE SILVA-MACNAY",$lc_prefix); # A stand alone function, returns: De Silva-MacNay
$error = $name->parse("MR AS & D.E. DE LA MARE");
%my_properties = $name->properties;
$number_surnames = $my_properties{number}; # 2
DESCRIPTION
This module takes as input a person or persons name in
This module takes as input one person's name or a couples names in
free format text such as,
Mr AB & M/s CD MacNay-Smith
......@@ -53,14 +75,15 @@ free format text such as,
Estate Of The Late Lieutenant Colonel AB Van Der Heiden
and attempts to parse it. If successful, the name is broken
down into components and useful functions can be performed like :
down into components and useful functions can be performed such as :
converting upper or lower case values to name case (Mr AB MacNay )
creating a personalised greeting or salutation (Dear Mr MacNay )
extracting the names individual components (Mr,AB,MacNay )
determining the type of format the name is in (Mr_A_Smith )
- converting upper or lower case values to name case (Mr AB MacNay )
- creating a personalised greeting or salutation (Dear Mr MacNay )
- extracting the names individual components (Mr,AB,MacNay )
- determining the type of format the name is in (Mr_A_Smith )
If the name cannot be parsed you have the option of cleaning the name
If the name(s) cannot be parsed you have the option of cleaning the name(s)
of bad characters, or extracting any portion that was parsed and the
portion that failed.
......
=head1 NAME
Lingua::EN::NameParse - extract the components of a person or couples full name, presented as a text string
Lingua::EN::NameParse - extract the components of a person or couples full name, from free form text
=head1 SYNOPSIS
......@@ -67,7 +67,7 @@ Lingua::EN::NameParse - extract the components of a person or couples full name,
=head1 DESCRIPTION
This module takes as input one person's name or a couples names in
This module takes as input one person's name or a couples name in
free format text such as,
Mr AB & M/s CD MacNay-Smith
......@@ -527,7 +527,7 @@ use Parse::RecDescent;
use Exporter;
use vars qw (@ISA @EXPORT_OK);
our $VERSION = '1.36';
our $VERSION = '1.37';
@ISA = qw(Exporter);
@EXPORT_OK = qw(clean case_surname);
......@@ -717,7 +717,8 @@ my %reverse_component_order=
'John_A_Smith' => ['surname_1','given_name_1','initials_1','suffix'],
'J_Adam_Smith' => ['surname_1','initials_1','middle_name','suffix'],
'John_Smith' => ['surname_1','given_name_1','suffix'],
'A_Smith' => ['surname_1','initials_1','suffix']
'A_Smith' => ['surname_1','initials_1','suffix'],
'John' => ['given_name_1']
);
#-------------------------------------------------------------------------------
......
......@@ -36,7 +36,7 @@ package Lingua::EN::NameParse::Grammar;
use strict;
use warnings;
our $VERSION = '1.36';
our $VERSION = '1.37';
# Rules that define valid orderings of a names components
......@@ -624,7 +624,7 @@ q{
# passed to the 'new' method.
my $given_name_min_2 = q{ given_name : given_name_standard };
my $given_name_min_2 = q{ given_name :/[A-Z]{2,} / | split_given_name };
# Joe, Jo-Anne ...
my $given_name_min_3 =
......