unitedstates/congress-legislators — pull request #145 by wilson428 (2013-10-17 19:13:43+00:00)
Title: added --relationship flag to bioguide.py for getting family members

Congressional bios include familial relationships to other members past and present in a parenthetical directly after the name. e.g.:

KENNEDY, Joseph P. III, (son of Joseph Patrick Kennedy, II, great-nephew of Edward Moore Kennedy and John Fitzgerald Kennedy, and great-great-grandson of John Francis Fitzgerald, first cousin once removed of Patrick Joseph Kennedy), a Representative from Massachusetts...

Because the relationship word ("great-nephew") can apply to multiple people, as in JPK III's case here, I'm using the NLTK lib's chunking parser to get names, then groups of names, then relationships, ultimately organized as a tree. This is arguably overkill and does add a dependency for an optional feature, but it works quite well.

Right now, this does not reconcile the family members with their bioguide id or other identifying information. Wouldn't be a difficult feature to add.