Class Parser
- Namespace
- NOpenNLP.Tools.Parser.Treeinsert
- Assembly
- NOpenNLP.Tools.dll
Built/attach parser. 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 assesed as either complete or incomplete. Complete nodes are no longer elligable 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.
public class Parser : AbstractBottomUpParser, IParser
- Inheritance
-
Parser
- Implements
- Inherited Members
Constructors
Parser(ParserModel, int, double)
public Parser(ParserModel model, int beamSize = 20, double advancePercentage = 0.95)
Parameters
modelParserModelbeamSizeintadvancePercentagedouble
Fields
ATTACH_DAUGHTER
Outcome used when a node should be attached as a daughter to another node.
public const string ATTACH_DAUGHTER = "d"
Field Value
ATTACH_SISTER
Outcome used when a node should be attached as a sister to another node.
public const string ATTACH_SISTER = "s"
Field Value
BUILT
Label used to distinguish build nodes from non-built nodes.
public const string BUILT = "built"
Field Value
DONE
Outcome used when a constituent needs an no additional parent node/building.
public const string DONE = "d"
Field Value
NON_ATTACH
Outcome used when a node should not be attached to another node.
public const string NON_ATTACH = "n"
Field Value
Methods
AdvanceChunks(Parse, double)
Returns the top chunk sequences for the specified parse.
protected override Parse[] AdvanceChunks(Parse p, double minChunkScore)
Parameters
pParseA pos-tag assigned parse.
minChunkScoredoubleA minimum score below which chunks should not be advanced.
Returns
- Parse[]
The top chunk assignments to the specified parse.
AdvanceParses(Parse, double)
Advances the specified parse and returns the an array advanced parses whose probability accounts for more than the specified amount of probability mass.
protected override Parse[]? AdvanceParses(Parse p, double probMass)
Parameters
pParseThe parse to advance.
probMassdoubleThe amount of probability mass that should be accounted for by the advanced parses.
Returns
- Parse[]
AdvanceTop(Parse)
Adds the "TOP" node to the specified parse.
protected override void AdvanceTop(Parse p)
Parameters
pParseThe complete parse.
GetRightFrontier(Parse, ISet<string>)
Returns the right frontier of the specified parse tree with nodes ordered from deepest to shallowest.
public static IList<Parse> GetRightFrontier(Parse root, ISet<string> punctSet)
Parameters
Returns
Train(string, IObjectStream<Parse?>, IHeadRules, TrainingParameters)
public static ParserModel Train(string languageCode, IObjectStream<Parse?> parseSamples, IHeadRules rules, TrainingParameters mlParams)
Parameters
languageCodestringparseSamplesIObjectStream<Parse>rulesIHeadRulesmlParamsTrainingParameters
Returns
Exceptions
- IOException
if there is an error during reading
Train(string, IObjectStream<Parse?>, IHeadRules, int, int)
public static ParserModel Train(string languageCode, IObjectStream<Parse?> parseSamples, IHeadRules rules, int iterations, int cut)
Parameters
languageCodestringparseSamplesIObjectStream<Parse>rulesIHeadRulesiterationsintcutint
Returns
Exceptions
- IOException
if there is an error during reading