crf_entity_extractor.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:rasa_nlu 作者: RasaHQ 项目源码 文件源码
def persist(self, model_dir):
        # type: (Text) -> Dict[Text, Any]
        """Persist this model into the passed directory.

        Returns the metadata necessary to load the model again."""

        from sklearn.externals import joblib

        if self.ent_tagger:
            model_file_name = os.path.join(model_dir, "crf_model.pkl")

            joblib.dump(self.ent_tagger, model_file_name)
            return {"entity_extractor_crf": {"model_file": "crf_model.pkl",
                                             "crf_features": self.crf_features,
                                             "BILOU_flag": self.BILOU_flag,
                                             "version": 1}}
        else:
            return {"entity_extractor_crf": None}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号