@@ -7,21 +7,43 @@ Name Parser
77 :target: http://badge.fury.io/py/nameparser
88
99A simple Python (3.2+ & 2.6+) module for parsing human names into their
10- individual components. Pass the HumanName class a string containing a full name.
11- The name is split on spaces and then parsed into name parts based on placement
12- in the string and matches against known name pieces like titles. Access the name
13- via instance attributes.
10+ individual components.
11+
12+ * hn.title
13+ * hn.first
14+ * hn.middle
15+ * hn.last
16+ * hn.suffix
17+ * hn.nickname
18+
19+ Supports 3 different comma placement variations in the input string.
20+
21+ 1. Title Firstname "Nickname" Middle Middle Lastname Suffix
22+ 2. Lastname [Suffix], Title Firstname (Nickname) Middle Middle[,] Suffix [, Suffix]
23+ 3. Title Firstname M Lastname [Suffix], Suffix [Suffix] [, Suffix]
24+
25+ Instantiating the `HumanName ` class with a string splits on commas and then spaces,
26+ classifying name parts based on placement in the string and matches against known name
27+ pieces like titles and suffixes.
1428
1529It correctly handles some common conjunctions and special prefixes to last names
16- like "del". Titles can be chained together and include conjunctions to handle
30+ like "del". Titles and conjunctions can be chained together to handle complex
1731titles like "Asst Secretary of State". It can also try to correct capitalization
1832of all names that are all upper- or lowercase names.
1933
2034It attempts the best guess that can be made with a simple, rule-based approach.
21- Unicode is supported, but the parser is not likely to be useful for languages
22- that do not have a structure similar to English names. It's not perfect, but it
35+ Its main use case is English and it is not likely to be useful for languages
36+ that do not share the same structure as English names. It's not perfect, but it
2337gets you pretty far.
2438
39+ Installation
40+ ------------
41+
42+ ::
43+
44+ pip install nameparser
45+
46+
2547Quick Start Example
2648-------------------
2749
@@ -47,13 +69,7 @@ Quick Start Example
4769 'Juan de la Vega'
4870
4971
50- 3 different comma placement variations are supported:
51-
52- * Title Firstname "Nickname" Middle Middle Lastname Suffix
53- * Lastname [Suffix], Title Firstname (Nickname) Middle Middle[,] Suffix [, Suffix]
54- * Title Firstname M Lastname [Suffix], Suffix [Suffix] [, Suffix]
55-
56- The parser does not make any attempt to clean the input. It mostly just splits on white
72+ The parser does not attempt to correct mistakes in the input. It mostly just splits on white
5773space and puts things in buckets based on their position in the string. This also means
5874the difference between 'title' and 'suffix' is positional, not semantic. "Dr" is a title
5975when it comes before the name and a suffix when it comes after. ("Pre-nominal"
0 commit comments