Class DependencyParserME
java.lang.Object
opennlp.tools.depparse.DependencyParserME
- All Implemented Interfaces:
opennlp.tools.depparse.DependencyParser
@ThreadSafe
public class DependencyParserME
extends Object
implements opennlp.tools.depparse.DependencyParser
A greedy transition-based
DependencyParser: a classifier picks the next
arc-standard Transition for each configuration until the parse is
complete, always taking the highest scoring transition that is applicable.
The parser holds an immutable model and no per-parse state, so one instance can be shared between threads.
- Since:
- 3.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionopennlp.tools.depparse.DependencyTreestatic DependencyModeltrain(String languageCode, opennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample> samples, opennlp.tools.util.TrainingParameters parameters) Trains a greedy arc-standard parser model from dependency samples.
-
Constructor Details
-
DependencyParserME
Initializes aDependencyParserMEfrom aDependencyModel.- Parameters:
model- The model to parse with. Must not benull.- Throws:
IllegalArgumentException- Thrown ifmodelisnullor an outcome inventory is invalid or cannot parse a sentence.
-
-
Method Details
-
parse
- Specified by:
parsein interfaceopennlp.tools.depparse.DependencyParser- Throws:
IllegalStateException- Thrown if the model returns scores that do not match its outcomes or are not finite.
-
train
public static DependencyModel train(String languageCode, opennlp.tools.util.ObjectStream<opennlp.tools.depparse.DependencySample> samples, opennlp.tools.util.TrainingParameters parameters) throws IOException Trains a greedy arc-standard parser model from dependency samples.Non-projective samples have no arc-standard derivation and are skipped during event generation.
- Parameters:
languageCode- The ISO language code of the training data. Must not benull.samples- The training samples. Must not benull.parameters- TheTrainingParameters. Must not benulland must select an event model trainer.- Returns:
- A trained
DependencyModel. Nevernull. - Throws:
IOException- Thrown if reading the samples fails.IllegalArgumentException- Thrown if a parameter isnullor the configured trainer is not an event model trainer.
-