def _timex_from_node(self, node): """ Given a TIMEX2 node, create a timex object with the values of that node """ t = Timex() if node.hasAttribute('SET'): if node.getAttribute('SET').lower() == 'yes': t.type = 'set' if node.hasAttribute('PERIODICITY'): t.value = 'P' + node.getAttribute('PERIODICITY')[1:] if node.hasAttribute('VAL'): t.value = node.getAttribute('VAL') if node.hasAttribute('MOD'): t.mod = node.getAttribute('MOD') if node.hasAttribute('GRANUALITY'): t.freq = node.getAttribute('GRANUALITY')[1:] if node.hasAttribute('COMMENT'): t.comment = node.getAttribute('COMMENT') return t
def _timex_from_node(self, node): """ Given a TIMEX2 node, create a timex object with the values of that node """ t = Timex() if node.hasAttribute('SET'): if node.getAttribute('SET').lower() == 'yes': t.type = 'set' if node.hasAttribute('PERIODICITY'): t.value = 'P' + node.getAttribute('PERIODICITY')[1:] if node.hasAttribute('VAL'): t.value = node.getAttribute('VAL') if node.hasAttribute('MOD'): t.mod = node.getAttribute('MOD') if node.hasAttribute('GRANUALITY'): t.freq = node.getAttribute('GRANUALITY')[1:] if node.hasAttribute('COMMENT'): t.comment = node.getAttribute('COMMENT') return t
def _timex_from_node(self, node): """ Given a node representing a TIMEX3 element, return a timex object representing it """ t = Timex() if node.hasAttribute('tid'): t.id = int(node.getAttribute('tid')[1:]) if node.hasAttribute('value'): t.value = node.getAttribute('value') if node.hasAttribute('mod'): t.mod = node.getAttribute('mod') if node.hasAttribute('type'): t.type = node.getAttribute('type') if node.hasAttribute('freq'): t.freq = node.getAttribute('freq') if node.hasAttribute('quant'): t.quant = node.getAttribute('quant') if node.hasAttribute('comment'): t.comment = node.getAttribute('comment') if node.getAttribute('temporalFunction'): t.temporal_function = True if node.hasAttribute('functionInDocument'): t.document_role = node.getAttribute('functionInDocument') if node.hasAttribute('beginPoint'): t.begin_timex = int(node.getAttribute('beginPoint')[1:]) if node.hasAttribute('endPoint'): t.end_timex = int(node.getAttribute('endPoint')[1:]) if node.hasAttribute('anchorTimeID'): t.context = int(node.getAttribute('anchorTimeID')[1:]) return t
def _timex_from_node(self, node): """ Given a node representing a TIMEX3 element, return a timex object representing it """ t = Timex() if node.hasAttribute('tid'): t.id = int(node.getAttribute('tid')[1:]) if node.hasAttribute('value'): t.value = node.getAttribute('value') if node.hasAttribute('mod'): t.mod = node.getAttribute('mod') if node.hasAttribute('type'): t.type = node.getAttribute('type') if node.hasAttribute('freq'): t.freq = node.getAttribute('freq') if node.hasAttribute('quant'): t.quant = node.getAttribute('quant') if node.hasAttribute('comment'): t.comment = node.getAttribute('comment') if node.getAttribute('temporalFunction'): t.temporal_function = True if node.hasAttribute('functionInDocument'): t.document_role = node.getAttribute('functionInDocument') if node.hasAttribute('beginPoint'): t.begin_timex = int(node.getAttribute('beginPoint')[1:]) if node.hasAttribute('endPoint'): t.end_timex = int(node.getAttribute('endPoint')[1:]) if node.hasAttribute('anchorTimeID'): t.context = int(node.getAttribute('anchorTimeID')[1:]) return t