cfpb/regulations-parser — pull request #160 by cmc333333 (2014-01-03 19:08:37+00:00)
Title: Redesign Definitions Scoping

Previously, definitions worked something like this:

1. Search for "definition" sections/paragraphs as indicated by the word 'Definition(s)'/etc.
2. Within each, look through all children finding specific terms
3. For each term, mark it with the scope found in the 'definition' section

This strategy proves problematic for a number of reasons, including missing some definitions (which weren't in a 'definitions' section) and failing to determine the proper scope (e.g. when the scope is defined in a child of the 'definition' section, closer to the individual terms).

This rewrite uses a different strategy

1. Look for terms, keeping track of the parents ("lineage") of each.
2. If something's in smart quotes (which isn't enough to indicate it's a definition), look through the node's lineage to see if any would indicate a 'definitions' section
3. To determine scope, look through the node's lineage to find the closest node which defines scope

@theresaanna: this modifies a bunch of cruft *one level above* individual terms. Individual term processing remains basically the same

@khandelwal: the majority of the changed lines are in the test file, which had all sorts of PEP8 issues