@@ -7,21 +7,43 @@ Name Parser
7
7
:target: http://badge.fury.io/py/nameparser
8
8
9
9
A 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.
14
28
15
29
It 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
17
31
titles like "Asst Secretary of State". It can also try to correct capitalization
18
32
of all names that are all upper- or lowercase names.
19
33
20
34
It 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
23
37
gets you pretty far.
24
38
39
+ Installation
40
+ ------------
41
+
42
+ ::
43
+
44
+ pip install nameparser
45
+
46
+
25
47
Quick Start Example
26
48
-------------------
27
49
@@ -47,13 +69,7 @@ Quick Start Example
47
69
'Juan de la Vega'
48
70
49
71
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
57
73
space and puts things in buckets based on their position in the string. This also means
58
74
the difference between 'title' and 'suffix' is positional, not semantic. "Dr" is a title
59
75
when it comes before the name and a suffix when it comes after. ("Pre-nominal"
0 commit comments