package org.algorithm.core.cnn.model.impl;

import org.algorithm.core.cnn.dataset.RelationExtractionDataSet;
import org.algorithm.core.cnn.model.RelationExtractionModel;
import org.diagbot.pub.utils.PropertiesUtil;

import java.io.File;

/**
 * @Author: bijl
 * @Date: 2019/1/22 14:49
 * @Decription:
 */
public class RelationExtractionModelImpl extends RelationExtractionModel {
    /**
     */
    public RelationExtractionModelImpl() {

        PropertiesUtil prop = new PropertiesUtil("/algorithm.properties");

        String modelPath = prop.getProperty("basicPath");  // 模型基本路径
        String modelVersion = prop.getProperty("relationExtraction");
        String dataSetPath = modelPath.substring(0, modelPath.indexOf("model_version_replacement"));
        modelPath = modelPath.replace("model_version_replacement", modelVersion);  // 生成模型路径

        dataSetPath = dataSetPath + File.separator + modelVersion + File.separator + "char2id.json";

        RelationExtractionDataSet dataSet = new RelationExtractionDataSet(dataSetPath);
        this.init(modelPath);
        this.dataSet = dataSet;
    }
}
