Package opennlp.tools.parser.treeinsert
Class Parser
java.lang.Object
opennlp.tools.parser.AbstractBottomUpParser
opennlp.tools.parser.treeinsert.Parser
- All Implemented Interfaces:
Parser
A built-attach
Parser
implementation.
Nodes are built when their left-most child is encountered. Subsequent children are attached as daughters. Attachment is based on node in the right-frontier of the tree. After each attachment or building, nodes are assessed as either complete or incomplete. Complete nodes are no longer eligible for daughter attachment.
Complex modifiers which produce additional node levels of the same type are attached with sister-adjunction. Attachment can not take place higher in the right-frontier than an incomplete node.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Outcome used when a node should be attached as a daughter to another node.static final String
Outcome used when a node should be attached as a sister to another node.static final String
Label used to distinguish build nodes from non-built nodes.static final String
Outcome used when a constituent needs an no additional parent node/building.static final String
Outcome used when a node should not be attached to another node.Fields inherited from class opennlp.tools.parser.AbstractBottomUpParser
COMPLETE, CONT, defaultAdvancePercentage, defaultBeamSize, INC_NODE, INCOMPLETE, OTHER, START, TOK_NODE, TOP_NODE
-
Constructor Summary
ConstructorDescriptionParser
(ParserModel model) Instantiates aParser
via a givenmodel
.Parser
(ParserModel model, int beamSize, double advancePercentage) Instantiates aParser
via a givenmodel
and other configuration parameters. -
Method Summary
Modifier and TypeMethodDescriptiongetRightFrontier
(Parse root, Set<String> punctSet) Returns the right frontier of the specifiedtree
with nodes ordered from deepest to shallowest.static ParserModel
train
(String languageCode, ObjectStream<Parse> parseSamples, HeadRules rules, int iterations, int cutoff) Starts a training of aParserModel
.static ParserModel
train
(String languageCode, ObjectStream<Parse> parseSamples, HeadRules rules, TrainingParameters mlParams) Starts a training of aParserModel
.Methods inherited from class opennlp.tools.parser.AbstractBottomUpParser
buildDictionary, buildDictionary, collapsePunctuation, parse, parse, setErrorReporting, setParents
-
Field Details
-
DONE
Outcome used when a constituent needs an no additional parent node/building.- See Also:
-
ATTACH_SISTER
Outcome used when a node should be attached as a sister to another node.- See Also:
-
ATTACH_DAUGHTER
Outcome used when a node should be attached as a daughter to another node.- See Also:
-
NON_ATTACH
Outcome used when a node should not be attached to another node.- See Also:
-
BUILT
Label used to distinguish build nodes from non-built nodes.- See Also:
-
-
Constructor Details
-
Parser
Instantiates aParser
via a givenmodel
and other configuration parameters. Uses the default implementations ofPOSTaggerME
andChunkerME
.- Parameters:
model
- TheParserModel
to use.beamSize
- The number of different parses kept during parsing.advancePercentage
- The minimal amount of probability mass which advanced outcomes must represent. Only outcomes which contribute to the topadvancePercentage
will be explored.- Throws:
IllegalStateException
- Thrown if theParserType
is not supported.- See Also:
-
Parser
Instantiates aParser
via a givenmodel
. Uses the default implementations ofPOSTaggerME
andChunkerME
and default values forbeamSize
andadvancePercentage
.- Parameters:
model
- TheParserModel
to use.- Throws:
IllegalStateException
- Thrown if theParserType
is not supported.- See Also:
-
-
Method Details
-
getRightFrontier
Returns the right frontier of the specifiedtree
with nodes ordered from deepest to shallowest.- Parameters:
root
- Theroot
of the parse tree.punctSet
- A set of punctuation symbols to be used.- Returns:
- The right frontier of the specified parse tree.
-
train
public static ParserModel train(String languageCode, ObjectStream<Parse> parseSamples, HeadRules rules, TrainingParameters mlParams) throws IOException Starts a training of aParserModel
.- Parameters:
languageCode
- An ISO conform language code.parseSamples
- Thesamples
as input.rules
- TheHeadRules
to use.mlParams
- Theparameters
for training.- Returns:
- A valid
ParserModel
. - Throws:
IOException
- Thrown if IO errors occurred during training.
-
train
public static ParserModel train(String languageCode, ObjectStream<Parse> parseSamples, HeadRules rules, int iterations, int cutoff) throws IOException Starts a training of aParserModel
.- Parameters:
languageCode
- An ISO conform language code.parseSamples
- Thesamples
as input.rules
- TheHeadRules
to use.iterations
- The number of iterations to be conducted.cutoff
- The cut-off parameter to be used.- Returns:
- A valid
ParserModel
. - Throws:
IOException
- Thrown if IO errors occurred during training.
-