Search in sources :

Example 16 with AnnotationUnit

use of de.tudarmstadt.ukp.clarin.webanno.tsv.util.AnnotationUnit in project webanno by webanno.

the class WebannoTsv3Writer method getFirstUnit.

// for relation annotation drawn on multiple span annotation, we put the info only to the first
// unit
private AnnotationUnit getFirstUnit(AnnotationUnit aUnit) {
    SubTokenAnno sta = new SubTokenAnno();
    sta.setBegin(aUnit.begin);
    sta.setEnd(aUnit.end);
    sta.setText(aUnit.token);
    Set<AnnotationUnit> sus = new LinkedHashSet<>();
    AnnotationUnit firstUnit = null;
    for (AnnotationUnit u : getSubUnits(sta, sus)) {
        firstUnit = u;
        break;
    }
    return firstUnit;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) AnnotationUnit(de.tudarmstadt.ukp.clarin.webanno.tsv.util.AnnotationUnit)

Aggregations

AnnotationUnit (de.tudarmstadt.ukp.clarin.webanno.tsv.util.AnnotationUnit)16 AnnotationFS (org.apache.uima.cas.text.AnnotationFS)9 ArrayList (java.util.ArrayList)8 Type (org.apache.uima.cas.Type)8 Token (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token)6 List (java.util.List)6 Feature (org.apache.uima.cas.Feature)6 LinkedHashSet (java.util.LinkedHashSet)5 CasUtil.getType (org.apache.uima.fit.util.CasUtil.getType)5 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)4 FeatureStructure (org.apache.uima.cas.FeatureStructure)3 IOException (java.io.IOException)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 MorphologicalFeatures (de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.morph.MorphologicalFeatures)1 POS (de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS)1 Lemma (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Lemma)1 Sentence (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence)1 Stem (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Stem)1