Example usage for edu.stanford.nlp.ling CoreLabel setLemma

List of usage examples for edu.stanford.nlp.ling CoreLabel setLemma

Introduction

In this page you can find the example usage for edu.stanford.nlp.ling CoreLabel setLemma.

Prototype

@Override
public void setLemma(String lemma) 

Source Link

Usage

From source file:de.tudarmstadt.ukp.dkpro.core.stanfordnlp.util.CoreNlpUtils.java

License:Open Source License

public static CoreLabel tokenToWord(Token aToken) {
    CoreLabel t = new CoreLabel();

    t.setOriginalText(aToken.getCoveredText());
    t.setWord(aToken.getCoveredText());/*from w w  w.jav a2  s . c  om*/
    t.setBeginPosition(aToken.getBegin());
    t.setEndPosition(aToken.getEnd());

    if (aToken.getLemma() != null) {
        t.setLemma(aToken.getLemma().getValue());
    }

    if (aToken.getPos() != null) {
        t.setTag(aToken.getPos().getPosValue());
    }

    return t;
}

From source file:lv.pipe.NerTagger.java

License:Open Source License

public static CoreLabel makeCoreLabel(Annotation a) {
    CoreLabel wi = new CoreLabel();
    if (!a.has(LabelText.class) || a.getText().equals(BOUNDARY)) {
        wi.setWord(BOUNDARY);//from w w  w  .  j a  v a2 s .co m
        wi.set(AnswerAnnotation.class, OTHER);
        wi.set(NamedEntityTagGoldAnnotation.class, OTHER);
        wi.setLemma("_");
    } else {
        wi.setWord(a.getText());
    }
    wi.setIndex(a.get(LabelIndex.class, -1));
    wi.setLemma(a.get(LabelLemma.class, "_"));
    wi.set(LVFullTagAnnotation.class, a.get(LabelPosTag.class, "_"));
    wi.setTag(a.get(LabelPosTagSimple.class, "_"));
    wi.set(MorphologyFeatureStringAnnotation.class, a.get(LabelMorphoFeatures.class, "_"));
    wi.set(ParentAnnotation.class, Integer.toString((Integer) a.get(LabelParent.class, -1)));
    wi.set(LabelAnnotation.class, a.get(LabelDependency.class, "_"));
    return wi;
}