Package opennlp.tools.parser
Class AbstractBottomUpParser
java.lang.Object
opennlp.tools.parser.AbstractBottomUpParser
- All Implemented Interfaces:
- Parser
Abstract class which contains code to tag and chunk parses for bottom up parsing and
 leaves implementation of advancing parses and completing parses to extend class.
 
 Note: 
 The nodes within the returned parses are shared with other parses
 and therefore their parent node references will not be consistent with their child
 node reference.  setParents can be used to make the parents consistent
 with a particular parse, but subsequent calls to setParents can invalidate
 the results of earlier calls.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringOutcome used when a constituent is complete.static final StringPrefix for outcomes continuing a constituent.static final doubleThe default amount of probability mass required of advanced outcomes.static final intThe default beam size used if no beam size is given.static final StringThe label for the top if an incomplete node.static final StringOutcome used when a constituent is incomplete.static final StringOutcome for token which is not contained in a basal constituent.static final StringPrefix for outcomes starting a constituent.static final StringThe label for a token node.static final StringThe label for the top node.
- 
Constructor SummaryConstructorsConstructorDescriptionAbstractBottomUpParser(POSTagger tagger, Chunker chunker, HeadRules headRules, int beamSize, double advancePercentage) 
- 
Method SummaryModifier and TypeMethodDescriptionstatic DictionarybuildDictionary(ObjectStream<Parse> data, HeadRules rules, int cutoff) Creates a n-gramDictionaryfrom the specified data stream usingHeadRulesand specified cut-off.static DictionarybuildDictionary(ObjectStream<Parse> data, HeadRules rules, TrainingParameters params) Creates a n-gramDictionaryfrom the specified data stream using the specified head rule and specified cut-off.static Parse[]collapsePunctuation(Parse[] chunks, Set<String> punctSet) Removes the punctuation from the specified set ofchunks, adds it to the parses adjacent to the punctuation is specified, and returns a new array of parses with the punctuation removed.Parse[]Returns the specified number of parses or fewer for the specified tokens.voidsetErrorReporting(boolean errorReporting) Specifies whether the parser should report when it was unable to find a parse for a particular sentence.static voidsetParents(Parse p) Assigns parent references for the specified parse so that they are consistent with the children references.
- 
Field Details- 
defaultBeamSizepublic static final int defaultBeamSizeThe default beam size used if no beam size is given.- See Also:
 
- 
defaultAdvancePercentagepublic static final double defaultAdvancePercentageThe default amount of probability mass required of advanced outcomes.- See Also:
 
- 
TOP_NODEThe label for the top node.- See Also:
 
- 
INC_NODEThe label for the top if an incomplete node.- See Also:
 
- 
TOK_NODEThe label for a token node.- See Also:
 
- 
STARTPrefix for outcomes starting a constituent.- See Also:
 
- 
CONTPrefix for outcomes continuing a constituent.- See Also:
 
- 
OTHEROutcome for token which is not contained in a basal constituent.- See Also:
 
- 
COMPLETEOutcome used when a constituent is complete.- See Also:
 
- 
INCOMPLETEOutcome used when a constituent is incomplete.- See Also:
 
 
- 
- 
Constructor Details- 
AbstractBottomUpParser
 
- 
- 
Method Details- 
setErrorReportingpublic void setErrorReporting(boolean errorReporting) Specifies whether the parser should report when it was unable to find a parse for a particular sentence.- Parameters:
- errorReporting-- trueif un-parsed sentences should be reported,- falseotherwise.
 
- 
setParentsAssigns parent references for the specified parse so that they are consistent with the children references.- Parameters:
- p- The- Parsewhose parent references need to be assigned.
 
- 
collapsePunctuationRemoves the punctuation from the specified set ofchunks, adds it to the parses adjacent to the punctuation is specified, and returns a new array of parses with the punctuation removed.
- 
parseDescription copied from interface:ParserReturns the specified number of parses or fewer for the specified tokens.Note: The nodes within the returned parses are shared with other parses and therefore their parent node references will not be consistent with their child node reference. Parse.setParent(Parse)can be used to make the parents consistent with a particular parse, but subsequent calls tosetParentscan invalidate the results of earlier calls.
- 
parseDescription copied from interface:Parser
- 
buildDictionarypublic static Dictionary buildDictionary(ObjectStream<Parse> data, HeadRules rules, TrainingParameters params) throws IOException Creates a n-gramDictionaryfrom the specified data stream using the specified head rule and specified cut-off.- Parameters:
- data- The data stream of- parses.
- rules- The- HeadRulesfor the parses.
- params- The- TrainingParameterswhich can contain a- cutoff, the minimum number of entries required for the n-gram to be saved as part of the- Dictionary.
- Returns:
- A Dictionaryinstance.
- Throws:
- IOException
 
- 
buildDictionarypublic static Dictionary buildDictionary(ObjectStream<Parse> data, HeadRules rules, int cutoff) throws IOException Creates a n-gramDictionaryfrom the specified data stream usingHeadRulesand specified cut-off.- Parameters:
- data- The data stream of- parses.
- rules- The- HeadRulesfor the- parses.
- cutoff- The minimum number of entries required for the n-gram to be saved as part of the dictionary.
- Returns:
- A Dictionaryinstance.
- Throws:
- IOException
 
 
-