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 PretreatmentDiag extends Pretreatment {
    protected NegativeEnum[] nees_disease = new NegativeEnum[]{NegativeEnum.DISEASE};

    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);
            if (NlpUtil.isFeature(l.getProperty(), nees_disease)) {
                PreResult result = new PreResult();
                result.setUniqueName("诊断--");
                result.setDetailName("诊断--");
                result.setValue(NlpUtil.concept(l, NegativeEnum.DISEASE));
                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;
    }
}
