Skip to content

Commit b8db4dd

Browse files
committed
update read me
1 parent 7d92874 commit b8db4dd

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

README.rst

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ Supports 3 different comma placement variations in the input string.
3636
When there is ambiguity that cannot be resolved by a rule-based approach,
3737
HumanName prefers to handle the most common cases correctly. For example,
3838
"Dean" is not parsed as title because it is more common as a first name.
39+
(You can customize this behavior though, see `Customizing the Parser with
40+
Your Own Constants`_)
3941

4042
Unit Tests
4143
------------
@@ -191,8 +193,8 @@ These constants are set at the module level using nameparser.config_.
191193
Predefined Variables
192194
++++++++++++++++++++
193195

194-
These are available via ``from nameparser.config import constants`` or on the ``C``
195-
attribute of a ``HumanName`` instance, e.g. ``hn.C``.
196+
These are available via ``from nameparser.config import constants`` or on the
197+
``C`` attribute of a ``HumanName`` instance, e.g. ``hn.C``.
196198

197199
* **prefixes**:
198200
Parts that come before last names, e.g. 'del' or 'van'
@@ -285,15 +287,13 @@ Parser Customizations Are Module-Wide
285287

286288
When you modify the configuration, by default this will modify the behavior all
287289
HumanName instances. This could be a handy way to set it up for your entire
288-
project, but it could also lead to some unexpected behavior because changing one
289-
instance could modify the behavior of another instance.
290+
project, but it could also lead to some unexpected behavior because changing
291+
the config on one instance could modify the behavior of another instance.
290292

291293
::
292294

293-
>>> from nameparser import HumanName
294-
>>> from nameparser.config import constants
295-
>>> constants.titles.add('dean')
296295
>>> hn = HumanName("Dean Robert Johns")
296+
>>> hn.C.titles.add('dean')
297297
>>> hn
298298
<HumanName : [
299299
Title: 'Dean'
@@ -317,12 +317,9 @@ instance could modify the behavior of another instance.
317317

318318
If you'd prefer new instances to have their own config values, you can pass
319319
``None`` as the second argument (or ``constant`` keyword argument) when
320-
instantiating ``HumanName``. The instance's constants can be accessed via its
321-
``C`` attribute.
322-
323-
Note that each instance always has a ``C`` attribute, but if you didn't pass
324-
something falsey to the ``constants`` argument then you'd still be
325-
modifying the module-level config values with the behavior described above.
320+
instantiating ``HumanName``. Each instance always has a ``C`` attribute, but if
321+
you didn't pass something falsey to the ``constants`` argument then it's a
322+
reference to the module-level config values with the behavior described above.
326323

327324
::
328325

0 commit comments

Comments
 (0)