package org.diagbot.nlp.feature.extract;

import org.diagbot.nlp.participle.word.Lexeme;
import org.diagbot.nlp.participle.word.LexemePath;
import org.diagbot.nlp.util.NlpUtil;
import org.diagbot.nlp.util.Constants;
import org.diagbot.nlp.util.NegativeEnum;

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

public class CaseTokenSymptom extends CaseToken {

    private NegativeEnum[] nees_symptom = new NegativeEnum[]{NegativeEnum.SYMPTOM};

    {
        stop_symbol = NlpUtil.extendsSymbol(stop_symbol, new String[]{",", "，", ":", "："});
    }

    public List<Map<String, Object>> analyze(LexemePath<Lexeme> lexemePath) throws Exception {
        super.sn = 0;
        //词性
        String property = null;

        List<Map<String, Object>> featuresList = new ArrayList<>();
        for (int index = 0; index < lexemePath.size(); index++) {
            Lexeme lexeme = lexemePath.get(index);
            property = lexeme.getProperty();
            if (NlpUtil.isFeature(property, nees_symptom)) {          //特征词 症状
                lookFeatures(featuresList, index, lexemePath, lexeme, Constants.feature_type_symptom, nees_symptom, true);
                //症状前后max_range_search范围内查找关联特征信息 如时间 性质 诱因 部位等
            }
        }
        return featuresList;
    }
}
