Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Split confusion

by bliako (Monsignor)
on Jun 03, 2020 at 21:15 UTC ( [id://11117674]=note: print w/replies, xml ) Need Help??


in reply to Split confusion

Lingua::EN::NameParse and Text::Names can be of help here.

use Lingua::EN::NameParse qw(clean case_surname); use Text::Names; use strict; use warnings; # optional configuration arguments my %args = ( auto_clean => 1, lc_prefix => 1, initials => 3, allow_reversed => 1, joint_names => 0, extended_titles => 0 ); my $parser = Lingua::EN::NameParse->new(%args); my $error; for my $input ( 'JAMES SMITH-JONES', 'BOB SMITH-SMYTHE-SMITH', 'J. JONAH JAMESON', 'BILLY BOB THORNTON' ){ print "\n\ninput name is '$input'\n"; $error = $parser->parse($input); die "error: $error" if $error; print $parser->report; my $name3 = Text::Names::cleanName($input); print "name3: $name3\n"; }

btw if you are inserting names into DB :) xkcd#327

bw, bliako

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11117674]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-29 08:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found