Пример #1
0
 def __init__(self, mention, useAnnotations=False):
     """ initialize population template given an age mention
     if useAnnotation == True, then search the phrase for annotated
     age values and use those. Otherwise, use heuristics to identify 
     age values. """
     BaseMentionTemplate.__init__(self, mention, 'age')
     self.values = {}
     self.trueValues = {}
     self.nDiscardedValues = 0
     if useAnnotations:
         self.findAnnotatedValues(isGroundTruth=False)
     else:
         self.findDetectedValues()
     self.findAnnotatedValues(isGroundTruth=True)
Пример #2
0
 def __init__(self, mention):
   """ initialize population template given a population mention """
   BaseMentionTemplate.__init__(self, mention, 'time')
   self.value = 0
   self.units = ''
   for token in mention.tokens:
     if token.isNumber():
       # assume this number is the number of days, weeks, etc
       if token.isInteger():
         self.value = int(token.text)
       else:
         self.value = float(token.text)
     if token.text in self.unitSet:
       self.units = self.unitSet[token.text]
Пример #3
0
 def __init__(self, mention, useAnnotations=False):
   """ initialize population template given an age mention
       if useAnnotation == True, then search the phrase for annotated
       age values and use those. Otherwise, use heuristics to identify 
       age values. """
   BaseMentionTemplate.__init__(self, mention, 'age')
   self.values = {}
   self.trueValues = {}
   self.nDiscardedValues = 0
   if useAnnotations:
     self.findAnnotatedValues(isGroundTruth=False)    
   else:
     self.findDetectedValues()
   self.findAnnotatedValues(isGroundTruth=True)
Пример #4
0
 def __init__(self, mention, useAnnotations=False):
     """ initialize group template given a group mention """
     BaseMentionTemplate.__init__(self, mention, 'group', useAnnotations)
     self.sizes = []
     self.outcomeNumbers = []
     self.costValues = []
     self.eventrates = []
     self.role = 'unknown'
     self.groupSizeEvaluation = Evaluation()
     if useAnnotations:
         for token in self.mention.tokens:
             groupRole = token.getAnnotationAttribute(self.type, 'role')
             if groupRole == 'control':
                 self.role = groupRole
             elif groupRole == 'experiment':
                 self.role = groupRole
     else:
         if self.isControl():
             self.role = 'control'
         if self.isExperiment():
             self.role = 'experiment'
Пример #5
0
 def __init__(self, mention, useAnnotations=False):
     """ initialize group template given a group mention """
     BaseMentionTemplate.__init__(self, mention, "group", useAnnotations)
     self.sizes = []
     self.outcomeNumbers = []
     self.costValues = []
     self.eventrates = []
     self.role = "unknown"
     self.groupSizeEvaluation = Evaluation()
     if useAnnotations:
         for token in self.mention.tokens:
             groupRole = token.getAnnotationAttribute(self.type, "role")
             if groupRole == "control":
                 self.role = groupRole
             elif groupRole == "experiment":
                 self.role = groupRole
     else:
         if self.isControl():
             self.role = "control"
         if self.isExperiment():
             self.role = "experiment"
Пример #6
0
 def __init__(self, mention):
   """ initialize population template given a population mention """
   BaseMentionTemplate.__init__(self, mention, 'location')
Пример #7
0
 def setId(self, id):
   """ set the ID for this condition """
   id = 'c'+id
   BaseMentionTemplate.setId(self, id)
Пример #8
0
 def __init__(self, mention, useAnnotations=False):
   """ initialize condition template given a condition mention """
   BaseMentionTemplate.__init__(self, mention, 'condition', useAnnotations)
Пример #9
0
 def write(self, out):
     """ write contents of template to output stream """
     BaseMentionTemplate.write(self, out)
Пример #10
0
 def __init__(self, mention):
     """ initialize population template given a population mention """
     BaseMentionTemplate.__init__(self, mention, 'location')
Пример #11
0
 def write(self, out):
     """ write contents of template to output stream """
     BaseMentionTemplate.write(self, out)
Пример #12
0
 def setId(self, id):
     """ set the ID for this group """
     id = 'g' + id
     BaseMentionTemplate.setId(self, id)
Пример #13
0
 def partialSetMatch(self, mTemplate, ignoreSemanticTagList=["people"]):
     """ return number of tokens matched if the root template in this cluster is a partial match
         for the root template from another cluster. """
     return BaseMentionTemplate.partialSetMatch(self, mTemplate, ignoreSemanticTagList)
Пример #14
0
 def exactSetMatch(self, mTemplate, ignoreSemanticTagList=["people"]):
     """ return True if the token sets from a given mention template match
         the token set from this templates. """
     return BaseMentionTemplate.exactSetMatch(self, mTemplate, ignoreSemanticTagList)
Пример #15
0
 def __init__(self, mention, useAnnotations=False):
     """ initialize condition template given a condition mention """
     BaseMentionTemplate.__init__(self, mention, 'condition',
                                  useAnnotations)
Пример #16
0
 def setId(self, id):
     """ set the ID for this condition """
     id = 'c' + id
     BaseMentionTemplate.setId(self, id)
Пример #17
0
 def exactSetMatch(self, mTemplate, ignoreSemanticTagList=['people']):
     """ return True if the token sets from a given mention template match
         the token set from this templates. """
     return BaseMentionTemplate.exactSetMatch(self, mTemplate,
                                              ignoreSemanticTagList)
Пример #18
0
 def partialSetMatch(self, mTemplate, ignoreSemanticTagList=['people']):
     """ return number of tokens matched if the root template in this cluster is a partial match
         for the root template from another cluster. """
     return BaseMentionTemplate.partialSetMatch(self, mTemplate,
                                                ignoreSemanticTagList)
Пример #19
0
 def setId(self, id):
     """ set the ID for this group """
     id = "g" + id
     BaseMentionTemplate.setId(self, id)