Giter VIP home page Giter VIP logo

full-name-parser's People

Contributors

deyter avatar gennadiylitvinyuk avatar hxdef avatar rarothedude avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

full-name-parser's Issues

Running on PHP pre-5.6

Two installation issues:

During composer require adci/full-name-parser, composer returns:

[InvalidArgumentException] Could not find package adci/full-name-parser at any version matching your PHP version 5.5.34.0

Does this work with my PHP version? Can I use --ignore-platform-reqs to override?

Does it create vendor/autoload.php?
Do I need to specify require 'vendor/autoload.php' in my code?

Thanks.

Comparison with Python nameparser

How similar is this to the Python nameparser module?

I have previously found pretty good results with it on a set of 4,000+ names, many of which are international.

But I am now looking at moving the same process to PHP, and would like to find similar parsing results.

Name like "J. P. Gownder" incorrectly parsed

In the instance of "J. P. Gownder" (with space between "J." and "P."), "J. P." is actually a first name.

However, full-name-parser interprets the following:
First = "J."
Middle: "P."

Would parsing "J. P.", or correcting to "J.P.", as first name cause conflict with other rules?

Exception when parsing a name with multiple last names.

Hello! I got an exception when parsing a name a name with multiple last names: "Arantes Rodrigues, R". From what I could trace it goes to Parser::findExtraSuffix("R"), Parser::removeTokenWithRegex("/(R)/"), where it tries to remove all "R" from the string, resulting in more than one match, throwing the exception.

Incorrect name parsing when contains trailing space

Hi,
I am having real problems getting this to work inside WPAllImport, a WordPress plugin that imports CSV content in as User data.

WPAllImport works by me creating a template wherein input data maps to WordPress field data, eg. "first_name", "last_name" and a custom field named "name_mid").

But it also allows passing of input data to functions to allow processing of that data during import, before save.

My source name is field "name_full" (eg. Jokubas Phillip Gardner).

In the WPAllImport template, I am calling my function get_name_part in the first-, middle- and last-name fields like this...

[get_name_part({name_full[1]}, "first")]
[get_name_part({name_full[1]}, "middle")]
[get_name_part({name_full[1]}, "last")]

My function get_name_part should then take both the full source name and a string corresponding to your 'part' options...

Essentially, a single function should be able to return whichever part is specified, rather than write a separate function for each...

  require_once '/home/mysite/public_html/wp-content/plugins/cxt-user-wpai-import/full-name-parser/vendor/autoload.php';

  use ADCI\FullNameParser\Parser;

  // name eg. Jokūbas Phillip Gardner
  // part eg. title, first, middle, last, nick, suffix,
  // called via eg. [get_name_part({name_full[1]}, "first")]
  function get_name_part($name, $part) {

    $parser = new Parser(
      [
        'part' => $part,
        // 'fix_case' => FALSE,
        'throws' => FALSE
      ]
    );

    // Return the parsed name part
    $nameObject = $parser->parse($name);

    // Give it back to WPAllImport
    return $nameObject;

  }

The problem is...

  1. The first operation completes successfully. That is, putting [get_name_part({name_full[1]}, "first")] in my import settings' first_name field successfully saves a parsed first name (eg. "Jokubas") in the first_name WordPress field.

  2. However, things break down after that. [get_name_part({name_full[1]}, "last")] places no name at all in the last_name field. It repeatedly fails.

  3. And [get_name_part({name_full[1]}, "middle")] places an incorrect combination of the actual middle and last (eg. "Phillip Gardner") as middle name.

So the ultimate split is:

  • First: Jokubas
  • Middle: Phillip Gardner
  • Last: [blank]

This is not consistent with full-name-parser, which correctly parses outside of my function and import environment...

  • First: Jokubas
  • Middle: Phillip
  • Last: Gardner

I'm not sure what the reason is, but I feel like it may be something to do with calling the same function three times from the same import step, albeit with different parameters.

I thought about the need to destroy all variables at the end of the function, but "unset" on $name, $part, $parser or $nameObject does not fix anything.

Please could you assist?

Thanks.

Parsing Name Error -- Wrong Last Name

Odd one. The full name string "John J Oliveri" returns first name "John", middle name "J Ol" and lastname "eri"
I have tested it running through over a thousand names, this is the only serious error I have experienced.

I have looked at the ascii values to ensure the spaces and characters are normal values.
Testing running php7.2.0, Debian sid, and the newest release of full-name-parser.

Error Parsing Name

I have a name that consists of first name, middle initial, last name and suffix.

For example: John A Smith DDS

When parsed it returns as such:
fullName: "John A Smith DDS"
leadingInitial: null
firstName: "John"
nicknames: null
middleName: "A Smith"
lastName: "DDS"
academicTitle: null
suffix: null
errors: []

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.