Пример #1
0
    def annotate(self, dirCorpus, dirModel, typeCorpus, external=0):
        """
		Automatic annotation of references 
		
		Parameters
		----------
		dirCorpus : string
			directory where the references to be annotated are
		dirModel : string
			directory where the learned CRF model and SVM model have been saved
		typeCorpus : int, {1, 2, 3}
			1 : corpus 1, 2 : corpus 2...
		external : int, {1, 0}
			1 : if the references are external data except CLEO, 0 : if that of CLEO
			it is used to decide whether Bilbo learn call a SVM classification or not.
		"""
        corpus = Corpus(dirCorpus, self.options)
        self.crf.setDirModel(dirModel)  #
        files = corpus.getFiles()
        filesTab = self._list_split(files, 50)
        for fname in filesTab:
            if typeCorpus == 1:
                corpus = self.annotateCorpus1(dirModel, corpus, fname)
            elif typeCorpus == 2:
                corpus = self.annotateCorpus2(dirModel, corpus, fname, external)
            corpus.deleteAllFiles()

        self.deleteTmpFiles()