Search in sources :

Example 16 with TsvColumn

use of de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvColumn in project webanno by webanno.

the class Tsv3XSerializer method write.

public void write(PrintWriter aOut, TsvUnit aUnit) {
    TsvDocument doc = aUnit.getDocument();
    // Write unit ID
    aOut.print(aUnit.getId());
    aOut.print(FIELD_SEPARATOR);
    // Write unit offset
    aOut.printf("%d-%d", aUnit.getBegin(), aUnit.getEnd());
    aOut.print(FIELD_SEPARATOR);
    // Write unit text
    aOut.print(doc.getJCas().getDocumentText().substring(aUnit.getBegin(), aUnit.getEnd()));
    aOut.printf(FIELD_SEPARATOR);
    // Write the remaining columns according to the schema definition
    for (TsvColumn col : doc.getSchema().getHeaderColumns(doc.getActiveColumns())) {
        // Write all the values in this column - there could be multiple due to stacking
        writeValues(aOut, aUnit, col);
        aOut.printf(FIELD_SEPARATOR);
    }
}
Also used : TsvColumn(de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvColumn) TsvDocument(de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvDocument)

Aggregations

TsvColumn (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvColumn)16 Type (org.apache.uima.cas.Type)9 LayerType (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.LayerType)8 TsvSchema (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvSchema)8 TsvDocument (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvDocument)7 FeatureType (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.FeatureType)5 AnnotationFS (org.apache.uima.cas.text.AnnotationFS)5 JCas (org.apache.uima.jcas.JCas)5 Test (org.junit.Test)5 FeatureStructure (org.apache.uima.cas.FeatureStructure)4 TsvFormatHeader (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvFormatHeader)2 TsvToken (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvToken)2 Token (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token)2 Dependency (de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 Feature (org.apache.uima.cas.Feature)2 TsvChain (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvChain)1 TsvSentence (de.tudarmstadt.ukp.clarin.webanno.tsv.internal.tsv3x.model.TsvSentence)1