nameparser 1.2.0__tar.gz → 1.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nameparser-1.2.0 → nameparser-1.3.0}/MANIFEST.in +1 -1
- {nameparser-1.2.0/nameparser.egg-info → nameparser-1.3.0}/PKG-INFO +27 -15
- {nameparser-1.2.0 → nameparser-1.3.0}/README.rst +26 -14
- nameparser-1.3.0/nameparser/__main__.py +31 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser/_version.py +1 -1
- nameparser-1.3.0/nameparser/config/__init__.py +861 -0
- nameparser-1.3.0/nameparser/config/bound_first_names.py +12 -0
- nameparser-1.3.0/nameparser/config/capitalization.py +10 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser/config/conjunctions.py +2 -2
- nameparser-1.3.0/nameparser/config/prefixes.py +97 -0
- nameparser-1.3.0/nameparser/config/regexes.py +46 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser/config/suffixes.py +48 -9
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser/config/titles.py +55 -4
- nameparser-1.3.0/nameparser/parser.py +1578 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser/util.py +1 -2
- {nameparser-1.2.0 → nameparser-1.3.0/nameparser.egg-info}/PKG-INFO +27 -15
- nameparser-1.3.0/nameparser.egg-info/SOURCES.txt +46 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/pyproject.toml +13 -4
- nameparser-1.3.0/tests/__init__.py +0 -0
- nameparser-1.3.0/tests/base.py +71 -0
- nameparser-1.3.0/tests/conftest.py +68 -0
- nameparser-1.3.0/tests/test_bound_first_names.py +154 -0
- nameparser-1.3.0/tests/test_brute_force.py +816 -0
- nameparser-1.3.0/tests/test_capitalization.py +144 -0
- nameparser-1.3.0/tests/test_config_attribute_docstrings.py +79 -0
- nameparser-1.3.0/tests/test_conjunctions.py +276 -0
- nameparser-1.3.0/tests/test_constants.py +971 -0
- nameparser-1.3.0/tests/test_east_slavic_patronymic_order.py +194 -0
- nameparser-1.3.0/tests/test_first_name.py +69 -0
- nameparser-1.3.0/tests/test_initials.py +219 -0
- nameparser-1.3.0/tests/test_middle_name_as_last.py +122 -0
- nameparser-1.3.0/tests/test_nicknames.py +309 -0
- nameparser-1.3.0/tests/test_output_format.py +138 -0
- nameparser-1.3.0/tests/test_parser_util.py +39 -0
- nameparser-1.3.0/tests/test_prefixes.py +395 -0
- nameparser-1.3.0/tests/test_python_api.py +647 -0
- nameparser-1.3.0/tests/test_suffixes.py +448 -0
- nameparser-1.3.0/tests/test_titles.py +372 -0
- nameparser-1.3.0/tests/test_turkic_patronymic_order.py +302 -0
- nameparser-1.3.0/tests/test_variations.py +221 -0
- nameparser-1.2.0/nameparser/config/__init__.py +0 -288
- nameparser-1.2.0/nameparser/config/capitalization.py +0 -10
- nameparser-1.2.0/nameparser/config/prefixes.py +0 -47
- nameparser-1.2.0/nameparser/config/regexes.py +0 -28
- nameparser-1.2.0/nameparser/parser.py +0 -995
- nameparser-1.2.0/nameparser.egg-info/SOURCES.txt +0 -23
- nameparser-1.2.0/tests.py +0 -2630
- {nameparser-1.2.0 → nameparser-1.3.0}/AUTHORS +0 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/LICENSE +0 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser/__init__.py +0 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser/py.typed +0 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser.egg-info/dependency_links.txt +0 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser.egg-info/requires.txt +0 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/nameparser.egg-info/top_level.txt +0 -0
- {nameparser-1.2.0 → nameparser-1.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nameparser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: A simple Python module for parsing human names into their individual components.
|
|
5
5
|
Author-email: Derek Gulbranson <derek73@gmail.com>
|
|
6
6
|
License: LGPL
|
|
@@ -29,7 +29,7 @@ Dynamic: license-file
|
|
|
29
29
|
Name Parser
|
|
30
30
|
===========
|
|
31
31
|
|
|
32
|
-
|Build Status| |PyPI| |PyPI version| |Documentation|
|
|
32
|
+
|Build Status| |PyPI| |PyPI version| |Documentation| |License| |Downloads| |Codecov|
|
|
33
33
|
|
|
34
34
|
A simple Python (3.10+) module for parsing human names into their
|
|
35
35
|
individual components.
|
|
@@ -40,8 +40,12 @@ individual components.
|
|
|
40
40
|
* hn.last
|
|
41
41
|
* hn.suffix
|
|
42
42
|
* hn.nickname
|
|
43
|
+
* hn.maiden
|
|
43
44
|
* hn.surnames *(middle + last)*
|
|
45
|
+
* hn.given_names *(first + middle)*
|
|
44
46
|
* hn.initials *(first initial of each name part)*
|
|
47
|
+
* hn.last_base *(last, minus any prefixes)*
|
|
48
|
+
* hn.last_prefixes *(leading last-name particles, e.g. "van der")*
|
|
45
49
|
|
|
46
50
|
Supported Name Structures
|
|
47
51
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -93,17 +97,18 @@ Quick Start Example
|
|
|
93
97
|
>>> name = HumanName("Dr. Juan Q. Xavier de la Vega III (Doc Vega)")
|
|
94
98
|
>>> name
|
|
95
99
|
<HumanName : [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
title: 'Dr.'
|
|
101
|
+
first: 'Juan'
|
|
102
|
+
middle: 'Q. Xavier'
|
|
103
|
+
last: 'de la Vega'
|
|
104
|
+
suffix: 'III'
|
|
105
|
+
nickname: 'Doc Vega'
|
|
106
|
+
maiden: ''
|
|
102
107
|
]>
|
|
103
108
|
>>> name.last
|
|
104
109
|
'de la Vega'
|
|
105
110
|
>>> name.as_dict()
|
|
106
|
-
{'
|
|
111
|
+
{'title': 'Dr.', 'first': 'Juan', 'middle': 'Q. Xavier', 'last': 'de la Vega', 'suffix': 'III', 'nickname': 'Doc Vega', 'maiden': ''}
|
|
107
112
|
>>> str(name)
|
|
108
113
|
'Dr. Juan Q. Xavier de la Vega III (Doc Vega)'
|
|
109
114
|
>>> name.string_format = "{first} {last}"
|
|
@@ -122,12 +127,13 @@ and "post-nominal" would probably be better names.)
|
|
|
122
127
|
>>> name = HumanName("1 & 2, 3 4 5, Mr.")
|
|
123
128
|
>>> name
|
|
124
129
|
<HumanName : [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
title: ''
|
|
131
|
+
first: '3'
|
|
132
|
+
middle: '4 5'
|
|
133
|
+
last: '1 & 2'
|
|
134
|
+
suffix: 'Mr.'
|
|
135
|
+
nickname: ''
|
|
136
|
+
maiden: ''
|
|
131
137
|
]>
|
|
132
138
|
|
|
133
139
|
Customization
|
|
@@ -172,3 +178,9 @@ https://github.com/derek73/python-nameparser
|
|
|
172
178
|
:target: http://nameparser.readthedocs.io/en/latest/?badge=latest
|
|
173
179
|
.. |PyPI version| image:: https://img.shields.io/pypi/pyversions/nameparser.svg
|
|
174
180
|
:target: https://pypi.org/project/nameparser/
|
|
181
|
+
.. |License| image:: https://img.shields.io/pypi/l/nameparser.svg
|
|
182
|
+
:target: https://pypi.org/project/nameparser/
|
|
183
|
+
.. |Downloads| image:: https://static.pepy.tech/badge/nameparser
|
|
184
|
+
:target: https://pepy.tech/project/nameparser
|
|
185
|
+
.. |Codecov| image:: https://codecov.io/gh/derek73/python-nameparser/branch/master/graph/badge.svg
|
|
186
|
+
:target: https://codecov.io/gh/derek73/python-nameparser
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name Parser
|
|
2
2
|
===========
|
|
3
3
|
|
|
4
|
-
|Build Status| |PyPI| |PyPI version| |Documentation|
|
|
4
|
+
|Build Status| |PyPI| |PyPI version| |Documentation| |License| |Downloads| |Codecov|
|
|
5
5
|
|
|
6
6
|
A simple Python (3.10+) module for parsing human names into their
|
|
7
7
|
individual components.
|
|
@@ -12,8 +12,12 @@ individual components.
|
|
|
12
12
|
* hn.last
|
|
13
13
|
* hn.suffix
|
|
14
14
|
* hn.nickname
|
|
15
|
+
* hn.maiden
|
|
15
16
|
* hn.surnames *(middle + last)*
|
|
17
|
+
* hn.given_names *(first + middle)*
|
|
16
18
|
* hn.initials *(first initial of each name part)*
|
|
19
|
+
* hn.last_base *(last, minus any prefixes)*
|
|
20
|
+
* hn.last_prefixes *(leading last-name particles, e.g. "van der")*
|
|
17
21
|
|
|
18
22
|
Supported Name Structures
|
|
19
23
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -65,17 +69,18 @@ Quick Start Example
|
|
|
65
69
|
>>> name = HumanName("Dr. Juan Q. Xavier de la Vega III (Doc Vega)")
|
|
66
70
|
>>> name
|
|
67
71
|
<HumanName : [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
title: 'Dr.'
|
|
73
|
+
first: 'Juan'
|
|
74
|
+
middle: 'Q. Xavier'
|
|
75
|
+
last: 'de la Vega'
|
|
76
|
+
suffix: 'III'
|
|
77
|
+
nickname: 'Doc Vega'
|
|
78
|
+
maiden: ''
|
|
74
79
|
]>
|
|
75
80
|
>>> name.last
|
|
76
81
|
'de la Vega'
|
|
77
82
|
>>> name.as_dict()
|
|
78
|
-
{'
|
|
83
|
+
{'title': 'Dr.', 'first': 'Juan', 'middle': 'Q. Xavier', 'last': 'de la Vega', 'suffix': 'III', 'nickname': 'Doc Vega', 'maiden': ''}
|
|
79
84
|
>>> str(name)
|
|
80
85
|
'Dr. Juan Q. Xavier de la Vega III (Doc Vega)'
|
|
81
86
|
>>> name.string_format = "{first} {last}"
|
|
@@ -94,12 +99,13 @@ and "post-nominal" would probably be better names.)
|
|
|
94
99
|
>>> name = HumanName("1 & 2, 3 4 5, Mr.")
|
|
95
100
|
>>> name
|
|
96
101
|
<HumanName : [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
title: ''
|
|
103
|
+
first: '3'
|
|
104
|
+
middle: '4 5'
|
|
105
|
+
last: '1 & 2'
|
|
106
|
+
suffix: 'Mr.'
|
|
107
|
+
nickname: ''
|
|
108
|
+
maiden: ''
|
|
103
109
|
]>
|
|
104
110
|
|
|
105
111
|
Customization
|
|
@@ -144,3 +150,9 @@ https://github.com/derek73/python-nameparser
|
|
|
144
150
|
:target: http://nameparser.readthedocs.io/en/latest/?badge=latest
|
|
145
151
|
.. |PyPI version| image:: https://img.shields.io/pypi/pyversions/nameparser.svg
|
|
146
152
|
:target: https://pypi.org/project/nameparser/
|
|
153
|
+
.. |License| image:: https://img.shields.io/pypi/l/nameparser.svg
|
|
154
|
+
:target: https://pypi.org/project/nameparser/
|
|
155
|
+
.. |Downloads| image:: https://static.pepy.tech/badge/nameparser
|
|
156
|
+
:target: https://pepy.tech/project/nameparser
|
|
157
|
+
.. |Codecov| image:: https://codecov.io/gh/derek73/python-nameparser/branch/master/graph/badge.svg
|
|
158
|
+
:target: https://codecov.io/gh/derek73/python-nameparser
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""Command-line debug helper: parse a name and print the result.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
|
|
5
|
+
python -m nameparser "Dr. Juan Q. Xavier de la Vega III"
|
|
6
|
+
"""
|
|
7
|
+
import logging
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
from nameparser import HumanName
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def main() -> None:
|
|
14
|
+
if len(sys.argv) <= 1:
|
|
15
|
+
print('Usage: python -m nameparser "Name String"')
|
|
16
|
+
raise SystemExit(1)
|
|
17
|
+
log = logging.getLogger('HumanName')
|
|
18
|
+
log.setLevel(logging.ERROR)
|
|
19
|
+
log.addHandler(logging.StreamHandler())
|
|
20
|
+
name_string = sys.argv[1]
|
|
21
|
+
hn = HumanName(name_string)
|
|
22
|
+
print(repr(hn))
|
|
23
|
+
hn.capitalize()
|
|
24
|
+
print(repr(hn))
|
|
25
|
+
# Use comma rather than concatenation: initials() returns
|
|
26
|
+
# empty_attribute_default (possibly None) when there are no initials.
|
|
27
|
+
print("Initials:", hn.initials())
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == '__main__':
|
|
31
|
+
main()
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
VERSION = (1,
|
|
1
|
+
VERSION = (1, 3, 0)
|
|
2
2
|
__version__ = '.'.join(map(str, VERSION))
|