Skip to content

Commit 45972f6

Browse files
committed
update docs
1 parent f2842bd commit 45972f6

1 file changed

Lines changed: 14 additions & 50 deletions

File tree

docs/customize.rst

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,24 @@ instantiate the :py:class:`~nameparser.parser.HumanName` class (see below).
3939
Editable attributes of nameparser.config.CONSTANTS
4040
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4141

42-
* :py:attr:`~nameparser.config.Constants.titles` - Pieces that come before the name. Cannot include things that may be first names
43-
* :py:attr:`~nameparser.config.Constants.first_name_titles` - Titles that, when followed by a single name, that name is a first name, e.g. "King David"
44-
* :py:attr:`~nameparser.config.Constants.suffix_acronyms` - Pieces that come at the end of the name that may or may not have periods separating the letters, e.g. "m.d."
45-
* :py:attr:`~nameparser.config.Constants.suffix_not_acronyms` - Pieces that come at the end of the name that never have periods separating the letters, e.g. "Jr."
46-
* :py:attr:`~nameparser.config.Constants.conjunctions` - Connectors like "and" that join the preceeding piece to the following piece.
47-
* :py:attr:`~nameparser.config.Constants.prefixes` - Connectors like "del" and "bin" that join to the following piece but not the preceeding
48-
* :py:attr:`~nameparser.config.Constants.capitalization_exceptions` - Dictionary of pieces that do not capitalize the first letter, e.g. "Ph.D"
49-
* :py:attr:`~nameparser.config.Constants.regexes` - Regular expressions used to find words, initials, nicknames, etc.
50-
51-
Each set of constants comes with `add()` and `remove()` methods for tuning
42+
* :py:obj:`~nameparser.config.Constants.titles` - Pieces that come before the name. Cannot include things that may be first names
43+
* :py:obj:`~nameparser.config.Constants.first_name_titles` - Titles that, when followed by a single name, that name is a first name, e.g. "King David"
44+
* :py:obj:`~nameparser.config.Constants.suffix_acronyms` - Pieces that come at the end of the name that may or may not have periods separating the letters, e.g. "m.d."
45+
* :py:obj:`~nameparser.config.Constants.suffix_not_acronyms` - Pieces that come at the end of the name that never have periods separating the letters, e.g. "Jr."
46+
* :py:obj:`~nameparser.config.Constants.conjunctions` - Connectors like "and" that join the preceeding piece to the following piece.
47+
* :py:obj:`~nameparser.config.Constants.prefixes` - Connectors like "del" and "bin" that join to the following piece but not the preceeding
48+
* :py:obj:`~nameparser.config.Constants.capitalization_exceptions` - Dictionary of pieces that do not capitalize the first letter, e.g. "Ph.D"
49+
* :py:obj:`~nameparser.config.Constants.regexes` - Regular expressions used to find words, initials, nicknames, etc.
50+
51+
Each set of constants comes with :py:func:`~nameparser.config.SetManager.add` and :py:func:`~nameparser.config.SetManager.remove` methods for tuning
5252
the constants for your project. These methods automatically lower case and
5353
remove punctuation to normalize them for comparison.
5454

5555
Other editable attributes
5656
~~~~~~~~~~~~~~~~~~~~~~~~~~
5757

58-
* :py:attr:`~nameparser.config.Constants.string_format`
59-
* :py:attr:`~nameparser.config.Constants.empty_attribute_default`
58+
* :py:obj:`~nameparser.config.Constants.string_format` - controls output from `str()`
59+
* :py:obj:`~nameparser.config.Constants.empty_attribute_default` - value returned by empty attributes, defaults to empty string
6060

6161

6262

@@ -204,42 +204,6 @@ data after assigning the full name, the name will need to be re-parsed with the
204204
:py:func:`~nameparser.parser.HumanName.parse_full_name()` method before you see
205205
those changes with ``repr()``.
206206

207-
::
208-
209-
>>> from nameparser import HumanName
210-
>>> from nameparser.config import CONSTANTS
211-
>>> hn = HumanName("Dean Robert Johns")
212-
>>> hn
213-
<HumanName : [
214-
title: ''
215-
first: 'Dean'
216-
middle: 'Robert'
217-
last: 'Johns'
218-
suffix: ''
219-
nickname: ''
220-
]>
221-
>>> CONSTANTS.titles.add('dean')
222-
SetManager({'right', ..., 'tax'})
223-
>>> hn
224-
<HumanName : [
225-
title: ''
226-
first: 'Dean'
227-
middle: 'Robert'
228-
last: 'Johns'
229-
suffix: ''
230-
nickname: ''
231-
]>
232-
>>> hn.parse_full_name()
233-
>>> hn
234-
<HumanName : [
235-
title: 'Dean'
236-
first: 'Robert'
237-
middle: ''
238-
last: 'Johns'
239-
suffix: ''
240-
nickname: ''
241-
]>
242-
243207

244208
Adjusting names after parsing them
245209
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -260,10 +224,10 @@ The strings returned by the attribute names just join these lists with spaces.
260224

261225
>>> hn = HumanName("Juan Q. Xavier Velasquez y Garcia, Jr.")
262226
>>> hn.middle_list
263-
[u'Q.', u'Xavier']
227+
['Q.', 'Xavier']
264228
>>> hn.middle_list += ["Ricardo"]
265229
>>> hn.middle_list
266-
[u'Q.', u'Xavier', 'Ricardo']
230+
['Q.', 'Xavier', 'Ricardo']
267231

268232

269233
You can also replace any name bucket's contents by assigning a string or a list

0 commit comments

Comments
 (0)