Package eu.clarin.weblicht.wlfxb.io
Class TextCorpusStreamed
- java.lang.Object
-
- eu.clarin.weblicht.wlfxb.tc.xb.TextCorpusStored
-
- eu.clarin.weblicht.wlfxb.io.TextCorpusStreamed
-
- All Implemented Interfaces:
TextCorpus
,Closeable
,AutoCloseable
public class TextCorpusStreamed extends TextCorpusStored implements Closeable
Class TextCorpusStreamed is used for accessing specified annotation layers and (optionally) adding any new annotation layers from/to TextCorpus. Only specified in the constructor annotation layers are loaded into the memory. In case all the annotation layers should be loaded into the memory, useWLData
class.- Author:
- Yana Panchenko
-
-
Field Summary
-
Fields inherited from class eu.clarin.weblicht.wlfxb.tc.xb.TextCorpusStored
lang, layersInOrder, XML_NAME, XML_NAMESPACE
-
-
Constructor Summary
Constructors Constructor Description TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead)
Creates a TextCorpusStreamed from the given TCF input stream and specified annotation layers.TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead, OutputStream outputStream)
Creates a TextCorpusStreamed from the given TCF input stream, specified annotation layers and the output stream.TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead, OutputStream outputStream, boolean outputAsXmlFragment)
Creates a TextCorpusStreamed from the given TCF input stream, specified annotation layers and the output stream.TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead, OutputStream outputStream, List<MetaDataItem> metaDataToAdd)
Creates a TextCorpusStreamed from the given TCF input stream, specified annotation layers, output stream and meta data.
-
Method Summary
Modifier and Type Method Description void
close()
Closes the input and output streams associated with this object and releases any associated system resources.-
Methods inherited from class eu.clarin.weblicht.wlfxb.tc.xb.TextCorpusStored
afterUnmarshal, compose, connectLayers, createAntonymyLayer, createChunksLayer, createConstituentParsingLayer, createDependencyParsingLayer, createDependencyParsingLayer, createDiscourseConnectivesLayer, createDiscourseConnectivesLayer, createGeoLayer, createGeoLayer, createGeoLayer, createGeoLayer, createGeoLayer, createGeoLayer, createGeoLayer, createGeoLayer, createHyperonymyLayer, createHyponymyLayer, createLemmasLayer, createMatchesLayer, createMorphologyLayer, createMorphologyLayer, createMorphologyLayer, createMorphologyLayer, createMorphologyLayer, createMorphologyLayer, createNamedEntitiesLayer, createOrthographyLayer, createPhotenicsLayer, createPosTagsLayer, createReferencesLayer, createRelationsLayer, createSentencesLayer, createSentencesLayer, createSynonymyLayer, createTextLayer, createTextSourceLayer, createTextStructureLayer, createTokensLayer, createTokensLayer, createTopologicalFieldsLayer, createWordSensesLayer, createWordSplittingLayer, getAntonymyLayer, getChunksLayer, getConstituentParsingLayer, getDependencyParsingLayer, getDiscourseConnectivesLayer, getGeoLayer, getHyperonymyLayer, getHyponymyLayer, getLanguage, getLayers, getLemmasLayer, getMatchesLayer, getMorphologyLayer, getNamedEntitiesLayer, getOrthographyLayer, getPhoneticsLayer, getPosTagsLayer, getReferencesLayer, getRelationsLayer, getSentencesLayer, getSynonymyLayer, getTextLayer, getTextSourceLayer, getTextStructureLayer, getTokensLayer, getTopologicalFieldsLayer, getWordSensesLayer, getWordSplittingLayer, setAntonymyLayer, setChunksLayer, setConstituentParsingLayer, setDependencyParsingLayer, setDiscourseConnectivesLayer, setGeoLayer, setHyperonymyLayer, setHyponymyLayer, setLemmasLayer, setMatchesLayer, setMorphologyLayer, setNamedEntitiesLayer, setOrthographyLayer, setPhoneticsLayer, setPosTagsLayer, setReferencesLayer, setRelationsLayer, setSentencesLayer, setSynonymyLayer, setTextLayer, setTextSourceLayer, setTextStructureLayer, setTokensLayer, setTopologicalFieldsLayer, setWordSensesLayer, setWordSplittingLayer, toString
-
-
-
-
Constructor Detail
-
TextCorpusStreamed
public TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead) throws WLFormatException
Creates a TextCorpusStreamed from the given TCF input stream and specified annotation layers.- Parameters:
inputStream
- the underlying input stream with linguistic annotations in TCF format.layersToRead
- the annotation layers of TextCorpus that should be read into this TextCorpusStreamed.- Throws:
WLFormatException
- if an error in input format or an I/O error occurs.
-
TextCorpusStreamed
public TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead, OutputStream outputStream) throws WLFormatException
Creates a TextCorpusStreamed 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.layersToRead
- the annotation layers of TextCorpus that should be read into this TextCorpusStreamed.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.
-
TextCorpusStreamed
public TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead, OutputStream outputStream, boolean outputAsXmlFragment) throws WLFormatException
Creates a TextCorpusStreamed 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.layersToRead
- the annotation layers of TextCorpus that should be read into this TextCorpusStreamed.outputStream
- the underlying output stream into which the annotations from the input stream and any new created annotations will be written (in TCF format).outputAsXmlFragment
- true if the output should not contain xml headers, false otherwise.- Throws:
WLFormatException
- if an error in input format or an I/O error occurs.
-
TextCorpusStreamed
public TextCorpusStreamed(InputStream inputStream, EnumSet<TextCorpusLayerTag> layersToRead, OutputStream outputStream, List<MetaDataItem> metaDataToAdd) throws WLFormatException
Creates a TextCorpusStreamed from the given TCF input stream, specified annotation layers, output stream and meta data.- Parameters:
inputStream
- the underlying input stream with linguistic annotations in TCF format.layersToRead
- the annotation layers of TextCorpus that should be read into this TextCorpusStreamed.outputStream
- the underlying output stream into which the annotations from the input stream and any new created annotations will be written (in TCF format).metaDataToAdd
- meta data to be added to the output TCF.- Throws:
WLFormatException
- if an error in input format or an I/O error occurs.
-
-
Method Detail
-
close
public void close() throws WLFormatException
Closes 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 TextCorpusStreamed 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 TextCorpusStreamed has been closed, adding further annotations will have no effect on the output stream.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
WLFormatException
- if an error in input format or an I/O error occurs.
-
-