Human Names API
This contains utilities, blockers, and comparers relevant to human names
mismo.lib.name.normalize_name
normalize_name(name: StructValue) -> StructValue
Convert to uppercase, normalize whitespace, and remove non-alphanumeric.
PARAMETER | DESCRIPTION |
---|---|
name
|
The name to normalize.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
name_normed
|
The normalized name.
TYPE:
|
mismo.lib.name.are_aliases
are_aliases(
name1: StringValue, name2: StringValue
) -> BooleanValue
are_aliases(name1, name2)
Determine if two names are nickname interchangeable.
This is case-insensitive, and whitespace is stripped from both ends. The same name returns True.
mismo.lib.name.is_nickname_for
is_nickname_for(
nickname: StringValue, canonical: StringValue
) -> BooleanValue
is_nickname_for(nickname, canonical)
Determine if a name is a nickname for another name.
This is case-insensitive, and whitespace is stripped from both ends. The same name returns True.
mismo.lib.name.NameMatchLevel
Bases: MatchLevel
How closely two names match.
mismo.lib.name.NameMatchLevel.ELSE
class-attribute
instance-attribute
ELSE = 6
None of the above.
mismo.lib.name.NameMatchLevel.EXACT
class-attribute
instance-attribute
EXACT = 1
The names are exactly the same.
mismo.lib.name.NameMatchLevel.GIVEN_SURNAME
class-attribute
instance-attribute
GIVEN_SURNAME = 2
The given and surnames both match.
mismo.lib.name.NameMatchLevel.INITIALS
class-attribute
instance-attribute
INITIALS = 4
The first letter of the given name matches, and the surnames match.
mismo.lib.name.NameMatchLevel.NICKNAMES
class-attribute
instance-attribute
NICKNAMES = 3
The given names match with nicknames, and the surnames match.
mismo.lib.name.NameMatchLevel.NULL
class-attribute
instance-attribute
NULL = 0
At least one given or surname is NULL from either side.
mismo.lib.name.NameMatchLevel.TYPO
class-attribute
instance-attribute
TYPO = 5
The given names are the same (forgiving typos), and the surnames match.
mismo.lib.name.NameComparer
Compare names. Assumes the names have already been normalized/featurized.
mismo.lib.name.NameComparer.Levels
class-attribute
instance-attribute
Levels = NameMatchLevel
The levels of name comparison.
mismo.lib.name.NameComparer.__call__
__call__(
table: Table | None = None,
*,
left: StructValue | None = None,
right: StructValue | None = None,
) -> IntegerValue
Compare two names.
PARAMETER | DESCRIPTION |
---|---|
left
|
The left name.
TYPE:
|
right
|
The right name.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
t
|
The comparison result.
TYPE:
|
mismo.lib.name.NameDimension
Prepares, blocks, and compares based on a human name.
A name is a Struct of the type `struct< prefix: string, given: string, middle: string, surname: string, suffix: string, nickname: string,
`.
mismo.lib.name.NameDimension.compare
compare(t: Table) -> Table
Compare the left and right names.
PARAMETER | DESCRIPTION |
---|---|
t
|
The table to compare.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
t
|
The compared table.
TYPE:
|
mismo.lib.name.NameDimension.prepare_for_fast_linking
prepare_for_fast_linking(t: Table) -> Table
Add columns with the normalized name.
PARAMETER | DESCRIPTION |
---|---|
t
|
The table to prep.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
t
|
The prepped table. |