adci / full-name-parser Goto Github PK
View Code? Open in Web Editor NEWhttps://packagist.org/packages/adci/full-name-parser
License: MIT License
https://packagist.org/packages/adci/full-name-parser
License: MIT License
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.
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.
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?
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.
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...
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.
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.
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:
This is not consistent with full-name-parser, which correctly parses outside of my function and import environment...
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.
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.
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: []
Related to: #11
The error does not occur when the second initial from the third author's name is removed: "Villuendas, M. V." -> "Villuendas, M.".
Issue originally appeared in use with drupal/bibcite module: https://www.drupal.org/project/bibcite/issues/2945406
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.