Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HumanNameParse.java

Quality Gate Status Coverage Maven Central

Java port Author: Bruno P. Kinoshita

Original library Author: Jason Priem (credits go to him) Original library Author Website: https://github.com/jasonpriem/HumanNameParser.php

License: MIT

Description

Takes human names of arbitrary complexity and various wacky formats like:

  • J. Walter Weatherman
  • de la Cruz, Ana M.
  • James C. ('Jimmy') O'Dell, Jr.
  • Dr. Omar A.

and parses out the:

  • leading initial (Like "J." in "J. Walter Weatherman")
  • first name (or first initial in a name like 'R. Crumb')
  • nicknames (like "Jimmy" in "James C. ('Jimmy') O'Dell, Jr.")
  • middle names
  • last name (including compound ones like "van der Sar' and "Ortega y Gasset"), and
  • suffix (like 'Jr.', 'III')
  • salutations (like 'Mr.', 'Mrs.', 'Dr')
  • postnominals (like 'PHD', 'CPA')

Usage

<dependencies>
  <dependency>
    <groupId>com.tupilabs</groupId>
    <artifactId>human-name-parser</artifactId>
  </dependency>
</dependencies>
Name name = new Name("Sérgio Vieira de Mello");
HumanNameParserBuilder builder = new HumanNameParserBuilder(name);
HumanNameParserParser parser = builder.build();
String firstName = parser.getFirst();
String nicknames = parser.getNicknames();
// ...

Changelog

0.3 (2025-08-02)

  • #15 JUnit Jupiter migration (thanks to @mureinik).
  • #17 Fix for HumanNameParser incorrectly interprets some name components as postnominals (thanks to @CarlosManuelRodr).

0.2 (2020-07-09)

  • #10 support custom postnominals. We have added a builder to create a parser. It uses the same default values as before for suffixes, postnominals, prefixes, and salutations. But now users can tell the builder to replace or append values to these lists.

0.1 (2020-04-06)

  • Initial release to Maven Central

About

HumanNameParser.java, a Java port of HumanNameParser.php. Parser for human names in Java, all credit goes to @jasonpriem

Topics

Resources

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages