Skip to content

Latest commit

 

History

History
69 lines (51 loc) · 2.45 KB

README.md

File metadata and controls

69 lines (51 loc) · 2.45 KB

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 (20??-??-??)

  • #15 JUnit Jupiter migration (thanks to @mureinik).

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