Esempio n. 1
0
 def __init__(self, original_line):
     Line.__init__(self, original_line, id_position=0)
     try:
         self._cui=self.split_line[2]
     except IndexError:
         raise CUINotFoundError("There was no CUI in the line '%s'" % 
                                self._line)
     if self._cui=='':
         raise CUINotFoundError("There was no CUI in the line '%s'" % 
                                self._line)
     try:
         self._description=self.split_line[1]
         self._source=self.split_line[7]
         self._type=self.split_line[4].upper()
     except IndexError:
         raise ParsingError("Data missing from line '%s'" % self._line)
     # Some entities have no stated confidence. We use 0 in such cases,
     # so they can be eliminated from the workflow later.
     try:
         self.confidence=float(self.split_line[3])/1000.0
     except ValueError:
         raise NoConfidenceError("Could not parse a confidence value in "
                                 "line '%s'" % self._line)
     logging.log(ULTRADEBUG, "Created a MtiLine @ %d: %s (%s) %1.3f", 
                   self.line_id, self._cui,
                   self._description, self.confidence)
Esempio n. 2
0
 def __init__(self, original_line):
     Line.__init__(self, original_line, id_position=0)
     # Unnecessary - done in the Line constructor
     #line_breakup=self._line.split(self.split_char)
     try:
         self._cui = self.split_line[4]
     except IndexError:
         raise CUINotFoundError("There was no CUI in the line '%s'" %
                                self._line)
     if self._cui == '':
         raise CUINotFoundError("There was no CUI in the line '%s'" %
                                self._line)
     try:
         self._description = self.split_line[3]
         self._source = self.split_line[6]
         self._semtype = self.split_line[5]
     except IndexError:
         raise ParsingError("Data missing from line '%s'" % self._line)
     # Some entities have no stated confidence. We use 0 in such cases,
     # so they can be eliminated from the workflow later.
     try:
         self.confidence = float(self.split_line[2]) / 1000.0
     except ValueError:
         raise NoConfidenceError("Could not parse a confidence value in "
                                 "line '%s'" % self._line)
     try:
         locations = self.split_line[8].split(',')
     except:
         logging.debug("Could not find a location in line %s", self._line)
         locations = [""]
     locations = [x.split(':') for x in locations]
     locations.sort()
     # Use the first appearance of a term as its location
     self._location = locations[0]
     logging.log(ULTRADEBUG, "Created a MetamapLine @ %d: %s (%s) %1.3f",
                 self.line_id, self._cui, self._description,
                 self.confidence)
Esempio n. 3
0
 def __init__(self, original_line):
     Line.__init__(self, original_line, id_position=0)
     # Unnecessary - done in the Line constructor
     #line_breakup=self._line.split(self.split_char) 
     try:
         self._cui=self.split_line[4]
     except IndexError:
         raise CUINotFoundError("There was no CUI in the line '%s'" % 
                                self._line)
     if self._cui=='':
         raise CUINotFoundError("There was no CUI in the line '%s'" % 
                                self._line)
     try:
         self._description=self.split_line[3]
         self._source=self.split_line[6]
         self._semtype=self.split_line[5]
     except IndexError:
         raise ParsingError("Data missing from line '%s'" % self._line)
     # Some entities have no stated confidence. We use 0 in such cases,
     # so they can be eliminated from the workflow later.
     try:
         self.confidence=float(self.split_line[2])/1000.0
     except ValueError:
         raise NoConfidenceError("Could not parse a confidence value in "
                                 "line '%s'" % self._line)
     try:
         locations=self.split_line[8].split(',')
     except:
         logging.debug("Could not find a location in line %s", self._line)
         locations=[""]
     locations=[x.split(':') for x in locations]
     locations.sort()
     # Use the first appearance of a term as its location
     self._location=locations[0]
     logging.log(ULTRADEBUG, "Created a MetamapLine @ %d: %s (%s) %1.3f", 
                   self.line_id, self._cui,
                   self._description, self.confidence)
Esempio n. 4
0
 def __init__(self, original_line):
     Line.__init__(self,
                   original_line,
                   id_position=1,
                   id_decorator_remover=lambda x: [x])
Esempio n. 5
0
 def __init__(self, original_line):
     Line.__init__(self, original_line, id_position=1, 
                   id_decorator_remover=lambda x: [x])