Example #1
0
	def train(self):
		for dirPartition in self.dirPartitions:
			print "dirPartition", dirPartition
			(annotateDir, testDir, trainDir, modelDir, resultDir) = self.partitions.getDirTestNames(dirPartition)
			
			self._del_tmp_file(trainDir) # tmp file of test data are here
			bilbo = Bilbo(modelDir, self.bilboOptions, "crf_model_simple") # tmpFiles saved in modelDir if -k all
			bilbo.train(trainDir, modelDir, 1)
Example #2
0
	def train(self):
		for dirPartition in self.dirPartitions:
			print "dirPartition", dirPartition
			(annotateDir, testDir, trainDir, modelDir, resultDir) = self.partitions.getDirTestNames(dirPartition)
			
			#self._del_tmp_file(modelDir)
			bilbo = Bilbo(modelDir, self.bilboOptions, "crf_model_simple") # To save tmpFiles in modelDir
			bilbo.train(trainDir, modelDir, 1)
Example #3
0
File: Main.py Project: morban/bilbo
        print "\t input data folder where the data files are (training or labeling)"
        print "  arg2 : <string>"
        print "\t output data folder where the result files are saved\n"

    else:
        if options.g == "simple":
            bilbo = Bilbo(str(args[1]), options, "crf_model_simple")
        elif options.g == "detail":
            bilbo = Bilbo(str(args[1]), options, "crf_model_detail")

        dtype = options.t
        if dtype == "bibl":
            typeCorpus = 1
        elif dtype == "note":
            typeCorpus = 2
        dirModel = os.path.join(rootDir, "model/corpus") + str(typeCorpus) + "/" + options.m + "/"
        if not os.path.exists(dirModel):
            os.makedirs(dirModel)

        if options.T:  # training
            bilbo.train(str(args[0]), dirModel, typeCorpus)
        elif options.L:  # labeling
            if dtype == "note" and options.e:
                bilbo.annotate(str(args[0]), dirModel, typeCorpus, 1)
            else:
                bilbo.annotate(str(args[0]), dirModel, typeCorpus)
        else:
            print "Please choose training(-T option) or labeling(-L option)"

            # simpleLabeling("Y.-M. KIM et al., An Extension of PLSA for Document Clustering, In Proceedings of ACM 17th Conference on Information and Knowledge Management, 2008.")