Class ConlluDependencySampleStream
java.lang.Object
opennlp.tools.formats.conllu.ConlluDependencySampleStream
- All Implemented Interfaces:
AutoCloseable, opennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample>
public class ConlluDependencySampleStream
extends Object
implements opennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample>
Reads
samples directly from
CoNLL-U content, mapping
the HEAD and DEPREL columns of the basic dependency annotation.
This reader does not use ConlluStream, which merges multiword token ranges
with their syntactic words for token and lemma samples. Dependency samples instead
omit range lines and empty nodes while retaining the syntactic word rows. Sentences
with incomplete or invalid basic dependencies are skipped and counted.
- Since:
- 3.0.0
-
Constructor Summary
ConstructorsConstructorDescriptionConlluDependencySampleStream(opennlp.tools.util.InputStreamFactory in, ConlluTagset tagset) Initializes the stream. -
Method Summary
-
Constructor Details
-
ConlluDependencySampleStream
public ConlluDependencySampleStream(opennlp.tools.util.InputStreamFactory in, ConlluTagset tagset) throws IOException Initializes the stream.- Parameters:
in- The CoNLL-U content. Must not benull.tagset- The tagset whose part-of-speech column feeds the sample tags. Must not benull.- Throws:
IOException- Thrown if opening the content fails.IllegalArgumentException- Thrown if any parameter isnull.
-
-
Method Details
-
read
Sentences without a usable basic dependency annotation are skipped, and their count is logged once the content is exhausted.
- Specified by:
readin interfaceopennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample>- Throws:
IOException
-
reset
Reopens the content through the
InputStreamFactory, which must therefore produce a fresh stream on every call.- Specified by:
resetin interfaceopennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample>- Throws:
IOExceptionUnsupportedOperationException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceopennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample>- Throws:
IOException
-