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

model ParserModel
beamSize int
advancePercentage double

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

string

ATTACH_SISTER

Outcome used when a node should be attached as a sister to another node.

public const string ATTACH_SISTER = "s"

Field Value

string

BUILT

Label used to distinguish build nodes from non-built nodes.

public const string BUILT = "built"

Field Value

string

DONE

Outcome used when a constituent needs an no additional parent node/building.

public const string DONE = "d"

Field Value

string

NON_ATTACH

Outcome used when a node should not be attached to another node.

public const string NON_ATTACH = "n"

Field Value

string

Methods

AdvanceChunks(Parse, double)

Returns the top chunk sequences for the specified parse.

protected override Parse[] AdvanceChunks(Parse p, double minChunkScore)

Parameters

p Parse

A pos-tag assigned parse.

minChunkScore double

A 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

p Parse

The parse to advance.

probMass double

The 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

p Parse

The 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

root Parse

The root of the parse tree.

punctSet ISet<string>

The set of punctuation tags.

Returns

IList<Parse>

The right frontier of the specified parse tree.

Train(string, IObjectStream<Parse?>, IHeadRules, TrainingParameters)

public static ParserModel Train(string languageCode, IObjectStream<Parse?> parseSamples, IHeadRules rules, TrainingParameters mlParams)

Parameters

languageCode string
parseSamples IObjectStream<Parse>
rules IHeadRules
mlParams TrainingParameters

Returns

ParserModel

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

languageCode string
parseSamples IObjectStream<Parse>
rules IHeadRules
iterations int
cut int

Returns

ParserModel

Exceptions

IOException

if there is an error during reading