Giter Site home page Giter Site logo

rafork / humannameparser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kimryan/humannameparser

2.0 0.0 0.0 62 KB

Extract the components of a person or couples full name, from free form text

Home Page: http://search.cpan.org/dist/Lingua-EN-NameParse/

License: Other

Perl 100.00%

humannameparser's Introduction

NAME

Lingua::EN::NameParse - extract the components of a person or couples full name, from free form text 

SYNOPSIS

    use Lingua::EN::NameParse qw(clean case_surname);

    # optional configuration arguments
    my %args =
    (
        auto_clean      => 1,
        lc_prefix       => 1,
        initials        => 3,
        allow_reversed  => 1,
        joint_names     => 0,
        extended_titles => 0
    );

    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}; 

        $correct_casing = $name->case_all; 

        $correct_casing = $name->case_all_reversed ; 

        $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); # 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 one person's name or a couples names in
free format text such as,

    Mr AB & M/s CD MacNay-Smith
    MR J.L. D'ANGELO
    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 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     )


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.

This module can be used for analysing and improving the quality of
lists of names.



HOW TO INSTALL

    perl Makefile.PL
    make
    make test
    make install
    
    or
    
    perl Build.PL
    build
    build test
    build install    


AUTHOR

NameParse was written by Kim Ryan, kimryan at cpan dot org

COPYRIGHT AND LICENSE

Copyright (c) 2016 Kim Ryan. All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html).

humannameparser's People

Contributors

kimryan avatar

Stargazers

raf avatar raf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.