Package eu.clarin.weblicht.wlfxb.io
Class ExternalDataWithTextCorpusStreamed
- java.lang.Object
-
- eu.clarin.weblicht.wlfxb.io.ExternalDataWithTextCorpusStreamed
-
public class ExternalDataWithTextCorpusStreamed extends Object
Class ExternalDataWithTextCorpusStreamed represents TCF TextCorpus and ExternalData annotations. The class is used for accessing specified annotation layers and (optionally) adding any new annotation layers from/to TextCorpus and/or ExternalData. Only specified in the constructor annotation layers are loaded into the memory. In case all the annotation layers should be loaded into the memory, useWLDataclass.- Author:
- Yana Panchenko
-
-
Constructor Summary
Constructors Constructor Description ExternalDataWithTextCorpusStreamed(InputStream inputStream, EnumSet<ExternalDataLayerTag> edLayersToRead, EnumSet<TextCorpusLayerTag> tcLayersToRead)Creates a ExternalDataWithTextCorpusStreamed from the given TCF input stream and specified annotation layers.ExternalDataWithTextCorpusStreamed(InputStream inputStream, EnumSet<ExternalDataLayerTag> edLayersToRead, EnumSet<TextCorpusLayerTag> tcLayersToRead, OutputStream outputStream)Creates a ExternalDataWithTextCorpusStreamed from the given TCF input stream, specified annotation layers and the output stream.
-
Method Summary
Modifier and Type Method Description voidclose()Closes the input and output streams associated with this object and releases any associated system resources.ExternalDatagetExternalData()Gets ExternalData.TextCorpusgetTextCorpus()Gets TextCorpus.StringtoString()
-
-
-
Constructor Detail
-
ExternalDataWithTextCorpusStreamed
public ExternalDataWithTextCorpusStreamed(InputStream inputStream, EnumSet<ExternalDataLayerTag> edLayersToRead, EnumSet<TextCorpusLayerTag> tcLayersToRead) throws WLFormatException
Creates a ExternalDataWithTextCorpusStreamed from the given TCF input stream and specified annotation layers.- Parameters:
inputStream- the underlying input stream with linguistic annotations in TCF format.edLayersToRead- the annotation layers of ExternalData that should be read into this ExternalDataWithTextCorpusStreamed.tcLayersToRead- the annotation layers of TextCorpus that should be read into this ExternalDataWithTextCorpusStreamed.- Throws:
WLFormatException- if an error in input format or an I/O error occurs.
-
ExternalDataWithTextCorpusStreamed
public ExternalDataWithTextCorpusStreamed(InputStream inputStream, EnumSet<ExternalDataLayerTag> edLayersToRead, EnumSet<TextCorpusLayerTag> tcLayersToRead, OutputStream outputStream) throws WLFormatException
Creates a ExternalDataWithTextCorpusStreamed from the given TCF input stream, specified annotation layers and the output stream.- Parameters:
inputStream- the underlying input stream with linguistic annotations in TCF format.edLayersToRead- the annotation layers of ExternalData that should be read into this ExternalDataWithTextCorpusStreamed.tcLayersToRead- the annotation layers of TextCorpus that should be read into this ExternalDataWithTextCorpusStreamed.outputStream- the underlying output stream into which the annotations from the input stream and any new created annotations will be written (in TCF format).- Throws:
WLFormatException- if an error in input format or an I/O error occurs.
-
-
Method Detail
-
getTextCorpus
public TextCorpus getTextCorpus()
Gets TextCorpus.- Returns:
- TextCorpus
-
getExternalData
public ExternalData getExternalData()
Gets ExternalData.- Returns:
- ExternalData
-
close
public void close() throws WLFormatExceptionCloses the input and output streams associated with this object and releases any associated system resources. Before the streams are closed, all in-memory annotations of the ExternalDataWithTextCorpusStreamed and not-processed part of the input stream are written to the output stream. Therefore, it's important to call close() method, so that all the in-memory annotations are saved to the output stream. Once the ExternalDataWithTextCorpusStreamed has been closed, adding further annotations will have no effect on the output stream.- Throws:
WLFormatException- if an error in input format or an I/O error occurs.
-
-