package org.diagbot.nlp.relation.module.cell;

import org.diagbot.nlp.participle.ParticipleUtil;
import org.diagbot.nlp.participle.word.Lexeme;
import org.diagbot.nlp.participle.word.LexemePath;

import java.io.IOException;

public class PD {
    private String value;
    private String unit;

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        try {
            LexemePath<Lexeme> lexemes = ParticipleUtil.participle(value);
            if (lexemes.size() == 2) {
                this.value = lexemes.get(0).getText();
                this.unit = lexemes.get(1).getText();
            } else {
                this.value = value;
            }
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }
}
