Skip to content

Commit 0ab19fd

Browse files
derek73claude
andcommitted
docs: use dean, not chancellor, as the add-a-title example
chancellor is already in the default TITLES set, so the doctest's add() was a no-op demonstrating nothing. dean is genuinely absent (the old v1 docs' example word) -- and absent for a teachable reason, which the ambiguous-entries paragraph now uses: 'Dean' doubles as a given name, so a default that swallowed it would misparse 'Dean Martin'. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent cc7063f commit 0ab19fd

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

docs/concepts.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ this setting vary with?
5252
``spec`` you pass to ``render(spec)``, or a keyword to
5353
``initials()``/``capitalized()``)
5454

55-
"Chancellor" being a title is a fact about German-language input, not
56-
about any one dataset or report — that's a :class:`~nameparser.Lexicon`
57-
entry. A CRM that always exports "Family, Given" strings is a fact
55+
"Dean" being a title in your data is a fact about the language and
56+
domain the names come from (academic rosters, say), not about any one
57+
dataset or report — that's a :class:`~nameparser.Lexicon` entry. A CRM that always exports "Family, Given" strings is a fact
5858
about that one data source, not about the language of the names in
5959
it — that's a :class:`~nameparser.Policy`. One particular report
6060
wanting names formatted as "Family, Given" while every other consumer

docs/customize.rst

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Vocabulary: Lexicon
1414
.. doctest::
1515

1616
>>> from nameparser import Lexicon, Parser
17-
>>> lex = Lexicon.default().add(titles={"chancellor"})
18-
>>> Parser(lexicon=lex).parse("Chancellor Angela Merkel").title
19-
'Chancellor'
17+
>>> lex = Lexicon.default().add(titles={"dean"})
18+
>>> Parser(lexicon=lex).parse("Dean Robert Johns").title
19+
'Dean'
2020

2121
:meth:`~nameparser.Lexicon.add` and :meth:`~nameparser.Lexicon.remove`
2222
both return a new :class:`~nameparser.Lexicon` — the one you started
@@ -39,7 +39,11 @@ don't add new vocabulary by themselves; they narrow how an existing
3939
entry is read when it appears alone. If you're not sure whether a word
4040
you're adding is one of these ambiguous cases, leave it out — an
4141
unrecognized word usually still parses reasonably, while a wrongly
42-
disambiguated one silently picks the less likely reading.
42+
disambiguated one silently picks the less likely reading. (That
43+
conservatism is why ``dean`` above isn't in the default vocabulary in
44+
the first place: "Dean" is also a common given name, and a default
45+
that swallowed it as a title would misparse "Dean Martin" for
46+
everyone.)
4347

4448
Behavior: Policy
4549
-----------------
@@ -145,7 +149,7 @@ you parse.
145149
# myapp/names.py
146150
from nameparser import Lexicon, Parser, Policy
147151
148-
lex = Lexicon.default().add(titles={"chancellor"})
152+
lex = Lexicon.default().add(titles={"dean"})
149153
policy = Policy(strip_emoji=False)
150154
parser = Parser(lexicon=lex, policy=policy)
151155

0 commit comments

Comments
 (0)