joeyaurel / python-gedcom

Python module for parsing, analyzing, and manipulating GEDCOM files
https://gedcom.joeyaurel.dev
GNU General Public License v2.0
154 stars 39 forks source link

Suffixes and get_name #28

Open lilaconlee opened 5 years ago

lilaconlee commented 5 years ago

Any recommendations for handling suffixes in names? Looks like the parser is just splitting on /, but I could be missing something.

Currently the following names both return Jane and Lane:

1 NAME Jane /Lane/ 
1 NAME Jane /Lane/ Jr 
KeithPetro commented 5 years ago

If you're really wanting to get this, you could do something like this (if you don't want to change the source code). name_element would have to be an element with the NAME tag. There are a few ways you could get this:

name_element.get_value().split('/')[2].strip()

I would say it would be best to just make a get_suffix() method based on get_name(). It would basically be the same but you'd just want to strip out the 3rd split element instead of the first two.