Updated add_count_modifiers function
Updated add_count_modifiers function

The function now only adds modifiers from spacy ancestors of core counts.

It adds up to three variations of each core span:
- The original, unmodified span
- One with only modifiers contained within the core span
- One with those and all modifiers from span ancestors

Where spans overlap, it selects among them by first maximizing the number of modifiers, and then minimizing total text length. This means that if a modifier is used by multiple spans, it will be allocated to the one it is nearest.

This won’t be right all the time, but will catch a number of errors where spaCy’s parser is wonky and captures a lot of the sentence in ancestors.

ecohealthalliance/EpiTator