package org.algorithm.test;

import org.algorithm.core.cnn.entity.Lemma;
import org.algorithm.core.cnn.entity.Triad;
import org.algorithm.core.cnn.model.RelationExtractionEnsembleModel;

import java.util.ArrayList;
import java.util.List;

/**
 * 测试集成模型
 *
 * @Author: bijl
 * @Date: 2019/6/12 17:53
 * @Decription:
 */
public class ReEnsembleModelTest {

    public static void main(String[] args) {
        RelationExtractionEnsembleModel ensembleModel = new RelationExtractionEnsembleModel();
        List<List<String>> result = new ArrayList<>();
        List<Triad> triads = new ArrayList<>();
        Triad triad_1 = new Triad();
        Lemma l_1 = new Lemma();
        l_1.setPosition("3,4");
        l_1.setText("剧烈");

        Lemma l_2 = new Lemma();
        l_2.setPosition("5,6");
        l_2.setText("胸痛");

        triad_1.setL_1(l_1);
        triad_1.setL_2(l_2);
        for (int i = 0; i < 500; i++)  // 500个样本
            triads.add(triad_1);

        long start = System.nanoTime();
        for (int i=0; i<200; i++)  // 重复100次
        {
            result = ensembleModel.execute("患者剧烈胸痛头痛失眠不安", triads);
        }
        long elapsedTime = System.nanoTime() - start;
        System.out.println(result.size());
        System.out.println(elapsedTime);
    }
}
