class EvitaWrapper(ComponentWrapper): """Wrapper for Evita. See ComponentWrapper for more details on how component wrappers work. Instance variables parser - an instance of the Evita parser see ComponentWrapper for other variables.""" def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __init__ of the base class and sets component_name, parser, CREATION_EXTENSION and RETRIEVAL_EXTENSION.""" ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance) self.component_name = EVITA self.parser = Evita() self.CREATION_EXTENSION = 'evi.i' self.RETRIEVAL_EXTENSION = 'evi.o' def process_fragments(self): """Apply the Evita parser to each fragment. No arguments and no return value.""" for fragment in self.fragments: base = fragment[0] infile = "%s%s%s.%s" % (self.DIR_DATA, os.sep, base, self.CREATION_EXTENSION) outfile = "%s%s%s.%s" % (self.DIR_DATA, os.sep, base, self.RETRIEVAL_EXTENSION) self.parser.process(infile, outfile)
def __init__(self, tag, xmldoc, tarsqi_instance): """Calls __init__ of the base class and sets component_name, parser, CREATION_EXTENSION and RETRIEVAL_EXTENSION.""" ComponentWrapper.__init__(self, tag, xmldoc, tarsqi_instance) self.component_name = EVITA self.parser = Evita() self.CREATION_EXTENSION = 'evi.i' self.RETRIEVAL_EXTENSION = 'evi.o'
def process(self): """Hand in all document elements to Evita for processing. Document elements are instances of Tag with name=docelement. This is a simple approach that assumes that all document elements are processed the same way.""" for element in self.document.elements(): Evita(self.document, element).process_element()
def process(self): """Hand in all document elements to Evita for processing. Document elements are instances of Tag with name=docelement.""" imported_events = self._import_events() for element in self.document.elements(): Evita(self.document, element, imported_events).process_element() if self.document.options.import_events and EVALUATE_EVENT_IMPORT: self._evaluate_results(imported_events)