Class DependencySample
java.lang.Object
opennlp.tools.depparse.DependencySample
- All Implemented Interfaces:
Serializable, Sample
One dependency-annotated sentence: tokens, their part-of-speech tags, and the gold
DependencyTree over them. Used for training and evaluating a
DependencyParser.
Instances are immutable and safe to share between threads.
- Since:
- 3.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDependencySample(String[] tokens, String[] tags, DependencyTree tree) Initializes aDependencySample. -
Method Summary
-
Constructor Details
-
DependencySample
Initializes aDependencySample.- Parameters:
tokens- The input tokens. Must not benullor empty and must not containnullentries.tags- The part-of-speech tags aligned withtokens. Must not benull, must have the same length astokens, and must not containnullentries.tree- The dependency tree over the tokens. Must not benulland itsDependencyTree.size()must equal the number of tokens.- Throws:
IllegalArgumentException- Thrown if any parameter isnull,tokensis empty,tokensortagscontains anullentry, or the lengths of tokens, tags and tree disagree.
-
-
Method Details
-
getTokens
- Returns:
- The tokens of the sentence. Never
null.
-
getTags
- Returns:
- The part-of-speech tags aligned with the tokens. Never
null.
-
getTree
- Returns:
- The dependency tree over the tokens. Never
null.
-
equals
-
hashCode
-
toString
-