Esempio n. 1
0
    def before_file(self, fileobj, info={}):
        if not self.chain:
            ext = output_filetype_ext
            self.chain = filetype.printer_class(ext)("candidates")
            self.chain.handle_meta(Meta(None, None, None), info)
            self.candidate_factory = CandidateFactory()
            self.all_entities = collections.OrderedDict()

        self.chain.before_file(fileobj, info)
        self.current_corpus_name = re.sub(
            ".*/", "", re.sub("\.(xml|info)", "", fileobj.name))
Esempio n. 2
0
 def __init__(self, *args, **kwargs):
     super(NGramCounterHandler, self).__init__(*args, **kwargs)
     self.candidate_factory = CandidateFactory()
     self.chain = None
Esempio n. 3
0
 def before_file(self, fileobj, info={}):
     if not self.chain:
         self.chain = self.make_printer(info, None)
         self.candidate_factory = CandidateFactory()
     self.chain.before_file(fileobj, info)