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.Constants;
import org.diagbot.nlp.util.NegativeEnum;
import org.diagbot.nlp.util.NlpUtil;

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

public class CaseTokenVital extends CaseToken {
    {
        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;
        NegativeEnum[] nees = new NegativeEnum[]{NegativeEnum.VITAL_RESULT};
        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)) {          //特征词 化验
                lookFeatures(featuresList, index, lexemePath, lexeme, Constants.feature_type_vital, nees);
            }
        }
        return featuresList;
    }
}
