-
Notifications
You must be signed in to change notification settings - Fork 1
/
populationfinder.py
executable file
·42 lines (29 loc) · 1.22 KB
/
populationfinder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
# author: Rodney Summerscales
from rulebasedfinder import RuleBasedFinder
from dictionaryfinder import DictionaryFinder
######################################################################
# Population finder
######################################################################
class PopulationFinder(RuleBasedFinder):
""" Find and label tokens in phrase describing a population in a trial
"""
label = 'population'
# popWordFinder = None
def __init__(self):
""" Create a finder that identifies population phrases. All tokens in
the phrases are labeled 'population'.
"""
RuleBasedFinder.__init__(self, [self.label])
# self.popWordFinder = DictionaryFinder(self.label, wordFilename)
def applyRules(self, token):
""" Label the given token as a 'population'. Also label all of the neighboring
tokens in the same phrase.
"""
pass # for now we do nothing and rely on the "people" semantic tag for this info
# if token.hasLabel(self.label) == True:
# # token has already been labeled
# return
#
# if 'people' in token.semanticTags:
# token.addLabel(self.label)