def initialize_model(self): algorithm = model_config.get("algorithm") c1 = float(model_config.get("c1")) c2 = float(model_config.get("c2")) max_iterations = int(model_config.get("max_iterations")) self.model = sklearn_crfsuite.CRF(algorithm=algorithm, c1=c1, c2=c2, max_iterations=max_iterations, all_possible_transitions=True) print("-> 完成模型初始化")
def load_model(self, model_name ="model"): model_path = model_config.get("model_path").format(model_name) joblib.load(model_path)
def save_model(self, name='model'): model_path = model_config.get("model_path").format(name) joblib.dump(self.model, model_path) print("-> 完成模型存储")