people.name¶
ConvertableIntoName
module-attribute
¶
A type that can be converted into a Name instance.
LAST_NAME_CAPITALIZATION_RULES
module-attribute
¶
LAST_NAME_CAPITALIZATION_RULES = (
("^Mc([a-z])", lambda p: "Mc" + upper()),
)
Regex rules for heuristically normalizing last names; used for acl_anthology.people.name.Name.case_normalize.
LAST_NAME_LOWERCASE_PREFIXES
module-attribute
¶
LAST_NAME_LOWERCASE_PREFIXES = {
"al",
"bin",
"bint",
"da",
"de",
"del",
"de la",
"dela",
"della",
"di",
"dos",
"du",
"el",
"la",
"le",
"van",
"van den",
"van der",
"von",
"von der",
}
Strings that tend to be lowercased when prefixing a last name; used for NameSpecification.case_normalize().
SLUGIFY_REPLACEMENTS
module-attribute
¶
SLUGIFY_REPLACEMENTS = (['ʼ', '-'], ['’', '-'])
Custom replacement rules for name slugs.
Name ¶
A person's name.
Note
Name objects are frozen, meaning they are immutable. This allows them to be used as dictionary keys, but means that in order to change a name somewhere, you need to replace it with a new Name instance.
Attributes:
| Name | Type | Description |
|---|---|---|
first |
Optional[str]
|
First name part. Can be given as |
last |
str
|
Last name part. |
script |
Optional[str]
|
The script in which the name is written; only used for non-Latin script name variants. |
Examples:
>>> Name("Yang", "Liu")
>>> Name(last="Liu", first="Yang")
>>> Name(None, "Mausam")
as_bibtex
cached
¶
as_bibtex()
Returns:
| Type | Description |
|---|---|
str
|
The person's full name as formatted in a BibTeX entry. |
as_first_last ¶
as_first_last()
Returns:
| Type | Description |
|---|---|
str
|
The person's full name in the form '{first} {last}'. |
as_full ¶
as_full()
Builds the full name, determining the appropriate format based on the script.
Returns:
| Type | Description |
|---|---|
str
|
For Han names, this will be '{last}{first}'; for other scripts (or if no script is given), this will be '{first} {last}'. |
as_last_first ¶
as_last_first()
Returns:
| Type | Description |
|---|---|
str
|
The person's full name in the form '{last}, {first}'. |
case_normalize ¶
case_normalize(force=False)
Try to heuristically normalize the casing of the name.
By default, this only changes the name if it is currently all-lowercased or all-uppercased.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
force
|
bool
|
Always case-normalize, without checking the current casing. |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the name's script attribute is set, indicating a non-Latin script name. |
from_
classmethod
¶
from_(name)
Instantiate a Name dynamically from any type that can be converted into a Name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
ConvertableIntoName
|
A name as a string, dict, tuple, or Name instance. |
required |
Returns:
| Type | Description |
|---|---|
Name
|
A corresponding Name object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
|
TypeError
|
|
from_dict
classmethod
¶
from_dict(name)
from_string
classmethod
¶
from_string(name)
Instantiate a Name from a single string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
A name string given as either "{first} {last}" or "{last}, {first}". |
required |
Returns:
| Type | Description |
|---|---|
Name
|
A corresponding Name object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
from_xml
classmethod
¶
from_xml(variant)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variant
|
_Element
|
An XML element of a |
required |
Returns:
| Type | Description |
|---|---|
Name
|
A corresponding Name object. |
Note
This will work for <author> and <editor> tags as well, but those
are more efficiently parsed within
NameSpecification.from_xml().
NameSpecification ¶
A name specification on a paper etc., containing additional data fields for information or disambiguation besides just the name.
Attributes:
| Name | Type | Description |
|---|---|---|
parent |
Optional[Paper | Volume | Talk]
|
The Anthology item that this name specification belongs to. |
orcid |
Optional[str]
|
An ORCID that was supplied together with this name. |
affiliation |
Optional[str]
|
Professional affiliation. |
variants |
tuple[Name, ...]
|
Variant spellings of this name in different scripts. |
Note
The variants attribute is only intended for name variants stored via the
<variant> tag in the XML, i.e., for a name that has a variant in a different
script. It is not used when an author has published under different names
(for this functionality, see Person).
citeproc_dict
cached
property
¶
citeproc_dict
A citation object corresponding to this name for use with CiteProcJSON.
from_xml
classmethod
¶
from_xml(person)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
person
|
_Element
|
An XML element of an |
required |
Returns:
| Type | Description |
|---|---|
NameSpecification
|
A corresponding NameSpecification object. |
resolve ¶
resolve()
Resolve this name specification to a natural person.
Returns:
| Type | Description |
|---|---|
Person
|
The Person object that this name specification resolves to. |
Raises:
| Type | Description |
|---|---|
AnthologyException
|
If this name specification is not attached to an Anthology item (i.e., |