@@ -6,7 +6,7 @@ Name Parser
6
6
.. image :: https://badge.fury.io/py/nameparser.svg
7
7
:target: http://badge.fury.io/py/nameparser
8
8
9
- A simple Python module for parsing human names into their individual
9
+ A simple Python (3.2+ & 2.6+) module for parsing human names into their individual
10
10
components. The HumanName class splits a name string up into name parts
11
11
based on placement in the string and matches against known name pieces
12
12
like titles. It joins name pieces on conjunctions and special prefixes to
@@ -19,7 +19,8 @@ Unicode is supported, but the parser is not likely to be useful for languages
19
19
that to not share the same structure as English names. It's not perfect, but it
20
20
gets you pretty far.
21
21
22
- **Quick Start Example **
22
+ Quick Start Example
23
+ -------------------
23
24
24
25
::
25
26
@@ -35,9 +36,12 @@ gets you pretty far.
35
36
nickname: 'Doc Vega'
36
37
]>
37
38
>>> name.last
38
- u 'de la Vega'
39
+ 'de la Vega'
39
40
>>> name.as_dict()
40
- {u'last': u'de la Vega', u'suffix': u'III', u'title': u'Dr.', u'middle': u'Q. Xavier', u'nickname': u'Doc Vega', u'first': u'Juan'}
41
+ {'last': 'de la Vega', 'suffix': 'III', 'title': 'Dr.', 'middle': 'Q. Xavier', 'nickname': 'Doc Vega', 'first': 'Juan'}
42
+ >>> name.string_format = "{first} {last}"
43
+ >>> str(name)
44
+ 'Juan de la Vega'
41
45
42
46
43
47
3 different comma placement variations are supported for the string that you pass.
@@ -46,9 +50,10 @@ gets you pretty far.
46
50
* Lastname [Suffix], Title Firstname (Nickname) Middle Middle[,] Suffix [, Suffix]
47
51
* Title Firstname M Lastname [Suffix], Suffix [Suffix] [, Suffix]
48
52
49
- The parser does not make any attempt to clean the data that you provide. It mostly just puts
50
- things in buckets based on their position between the white spaces in the string. This also means
51
- the difference between 'title' and 'suffix' is positional, not semantic.
53
+ The parser does not make any attempt to clean the data. It mostly just splits on white
54
+ space and puts things in buckets based on their position in the string. This also means
55
+ the difference between 'title' and 'suffix' is positional, not semantic. ("Pre-nominal"
56
+ and "post-nominal" would probably be better names.)
52
57
53
58
::
54
59
@@ -63,19 +68,19 @@ the difference between 'title' and 'suffix' is positional, not semantic.
63
68
nickname: ''
64
69
]>
65
70
71
+ Customization
72
+ -------------
73
+
66
74
Your project may need a bit of adjustments for your dataset. You can
67
75
do this in your own pre- or post-processing, by `customizing the configured pre-defined
68
76
sets `_ of titles, prefixes, etc., or by subclassing the `HumanName ` class. See the
69
77
`full documentation `_ for more information.
70
78
71
- .. _customizing the configured pre-defined sets : http://nameparser.readthedocs.org/en/latest/customize.html
72
- .. _full documentation : http://nameparser.readthedocs.org/en/latest/
73
-
74
- Documentation
75
- -------------
76
79
77
80
`Full documentation `_
81
+ ~~~~~~~~~~~~~~~~~~~~~
78
82
83
+ .. _customizing the configured pre-defined sets : http://nameparser.readthedocs.org/en/latest/customize.html
79
84
.. _Full documentation : http://nameparser.readthedocs.org/en/latest/
80
85
81
86
0 commit comments