package org.diagbot.nlp.rule.pretreat;

import org.diagbot.nlp.participle.ParticipleUtil;
import org.diagbot.nlp.participle.word.Lexeme;
import org.diagbot.nlp.participle.word.LexemePath;
import org.diagbot.nlp.rule.module.PreResult;
import org.diagbot.nlp.util.NegativeEnum;
import org.diagbot.nlp.util.NlpUtil;

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

public class PretreatmentMakeList extends Pretreatment {
    protected NegativeEnum[] nees_pacs_name = new NegativeEnum[]{NegativeEnum.PACS_NAME};
    protected NegativeEnum[] nees_lis_type = new NegativeEnum[]{NegativeEnum.LIS_TYPE};

    public List<PreResult> analyze(String content) throws java.io.IOException{
        List<PreResult> preResults = new ArrayList<>();
        LexemePath<Lexeme> lexemes = ParticipleUtil.participle(content);
        for (int i = 0; i < lexemes.size(); i++) {
            Lexeme l = lexemes.get(i);
            PreResult result = new PreResult();
            result.setUniqueName("开单--");
            result.setDetailName("开单--");
            if (NlpUtil.isFeature(l.getProperty(), nees_pacs_name)) {
                result.setValue(NlpUtil.concept(l, NegativeEnum.PACS_NAME));
                preResults.add(result);
            } else if (NlpUtil.isFeature(l.getProperty(), nees_lis_type)) {
                result.setValue(NlpUtil.concept(l, NegativeEnum.LIS_TYPE));
                preResults.add(result);
            }
        }
        return preResults;
    }

    public PreResult createPreResult(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
        return null;
    }

    public String findBodyValue(LexemePath<Lexeme> lexemes, Lexeme lexeme, int index) {
        return null;
    }
}
