Package eu.clarin.weblicht.wlfxb.io
Class LexiconStreamed
- java.lang.Object
-
- eu.clarin.weblicht.wlfxb.lx.xb.LexiconStored
-
- eu.clarin.weblicht.wlfxb.io.LexiconStreamed
-
- All Implemented Interfaces:
Lexicon
public class LexiconStreamed extends LexiconStored
Class LexiconStreamed represents TCF Lexicon annotations. These annotations represent linguistic information on a list of words. The class is used for accessing specified annotation layers and (optionally) adding any new annotation layers from/to Lexicon. 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
-
-
Field Summary
-
Fields inherited from class eu.clarin.weblicht.wlfxb.lx.xb.LexiconStored
lang, layersInOrder, XML_NAME, XML_NAMESPACE
-
-
Constructor Summary
Constructors Constructor Description LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead)Creates a LexiconStreamed from the given TCF input stream and specified annotation layers.LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead, OutputStream outputStream)Creates a LexiconStreamed from the given TCF input stream, specified annotation layers and the output stream.LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead, OutputStream outputStream, boolean outputAsXmlFragment)Creates a LexiconStreamed from the given TCF input stream, specified annotation layers and the output stream.LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead, OutputStream outputStream, List<MetaDataItem> metaDataToAdd)Creates a LexiconStreamed from the given TCF input stream, specified annotation layers, output stream and meta data.
-
Method Summary
Modifier and Type Method Description voidclose()Closes the input and output streams associated with this object and releases any associated system resources.-
Methods inherited from class eu.clarin.weblicht.wlfxb.lx.xb.LexiconStored
afterUnmarshal, connectLayers, createCooccurrencesLayer, createEntriesLayer, createFrequenciesLayer, createPosTagsLayer, createSyllabificationsLayer, createSynonymsLayer, getCooccurrencesLayer, getEntriesLayer, getFrequenciesLayer, getLanguage, getPosTagsLayer, getSyllabificationsLayer, getSynonymsLayer, setCooccurrencesLayer, setEntriesLayer, setFrequenciesLayer, setPosTagsLayer, setSyllabificationsLayer, setSynonymsLayer, toString
-
-
-
-
Constructor Detail
-
LexiconStreamed
public LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead) throws WLFormatException
Creates a LexiconStreamed 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 Lexicon that should be read into this LexiconStreamed.- Throws:
WLFormatException- if an error in input format or an I/O error occurs.
-
LexiconStreamed
public LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead, OutputStream outputStream) throws WLFormatException
Creates a LexiconStreamed 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 Lexicon that should be read into this LexiconStreamed.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.
-
LexiconStreamed
public LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead, OutputStream outputStream, boolean outputAsXmlFragment) throws WLFormatException
Creates a LexiconStreamed 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 Lexicon that should be read into this LexiconStreamed.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.
-
LexiconStreamed
public LexiconStreamed(InputStream inputStream, EnumSet<LexiconLayerTag> layersToRead, OutputStream outputStream, List<MetaDataItem> metaDataToAdd) throws WLFormatException
Creates a LexiconStreamed 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 Lexicon that should be read into this LexiconStreamed.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 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 LexiconStreamed 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 LexiconStreamed 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.
-
-