ged4py.detail.name

Internal module for parsing names in gedcom format.

Functions

parse_name_altree(record)

Parse NAME structure assuming ALTREE dialect.

parse_name_ancestris(record)

Parse NAME structure assuming ANCESTRIS dialect.

parse_name_myher(record)

Parse NAME structure assuming MYHERITAGE dialect.

split_name(name)

Extracts pieces of name from full name string.

ged4py.detail.name.split_name(name)[source]

Extracts pieces of name from full name string.

Parameters
namestr

Full name string.

Returns
nametuple

3-tuple (given1, surname, given2), surname or given will be empty strings if they are not present in full string.

Notes

Full name can have one of these formats:

<NAME_TEXT> |
/<NAME_TEXT>/ |
<NAME_TEXT> /<NAME_TEXT>/ |
/<NAME_TEXT>/ <NAME_TEXT> |
<NAME_TEXT> /<NAME_TEXT>/ <NAME_TEXT>

<NAME_TEXT> can include almost anything excluding commas, numbers, special characters (though some test files use numbers for the names). Text between slashes is considered a surname, outside slashes - given name.

This method splits full name into pieces at slashes, e.g.:

"First /Last/" -> ("First", "Last", "")
"/Last/ First" -> ("", "Last", "First")
"First /Last/ Jr." -> ("First", "Last", "Jr.")
"First Jr." -> ("First Jr.", "", "")
ged4py.detail.name.parse_name_altree(record)[source]

Parse NAME structure assuming ALTREE dialect.

Parameters
recordged4py.model.Record

NAME record.

Returns
parsed_nametuple

Tuple with 3 or 4 elements, first three elements of tuple are the same as returned from split_name method, fourth element (if present) denotes maiden name.

Notes

In ALTREE dialect maiden name (if present) is saved as SURN sub-record and is also appended to family name in parens. Given name is saved in GIVN sub-record. Few examples:

No maiden name:

1 NAME John /Smith/
2 GIVN John

With maiden name:

1 NAME Jane /Smith (Ivanova)/
2 GIVN Jane
2 SURN Ivanova

No maiden name:

1 NAME Mers /Daimler (-Benz)/
2 GIVN Mers

Because family name can also contain parens it’s not enough to parse family name and guess maiden name from it, we also have to check for SURN record.

ALTREE also replaces empty names with question mark, we undo that too.

ged4py.detail.name.parse_name_myher(record)[source]

Parse NAME structure assuming MYHERITAGE dialect.

Parameters
recordged4py.model.Record

NAME record.

Returns
parsed_nametuple

Tuple with 3 or 4 elements, first three elements of tuple are the same as returned from split_name method, fourth element (if present) denotes maiden name.

Notes

In MYHERITAGE dialect married name (if present) is saved as _MARNM sub-record. Maiden name is stored in SURN record. Few examples:

No maiden name:

1 NAME John /Smith/
2 GIVN John
2 SURN Smith

With maiden name:

1 NAME Jane /Ivanova/
2 GIVN Jane
2 SURN Ivanova
2 _MARNM Smith

No maiden name:

1 NAME Mers /Daimler (-Benz)/
2 GIVN Mers
2 SURN Daimler (-Benz)
ged4py.detail.name.parse_name_ancestris(record)[source]

Parse NAME structure assuming ANCESTRIS dialect.

As far as I can tell Ancestris does not have any standard convention for representing maiden or married names. Best we can do in this situation is to use NAME record value and ignore any other fields.

Parameters
recordged4py.model.Record

NAME record.

Returns
parsed_nametuple

Tuple with 3 or 4 elements, first three elements of tuple are the same as returned from split_name method, fourth element (if present) denotes maiden name.