Class AbstractParserEventStream

Namespace
NOpenNLP.Tools.Parser
Assembly
NOpenNLP.Tools.dll

Abstract class extended by parser event streams which perform tagging and chunking.

public abstract class AbstractParserEventStream : AbstractEventStream<Parse>, IObjectStream<Event?>, IDisposable
Inheritance
AbstractParserEventStream
Implements
Derived
Inherited Members

Constructors

AbstractParserEventStream(IObjectStream<Parse?>, IHeadRules, ParserEventTypeEnum, Dictionary?)

protected AbstractParserEventStream(IObjectStream<Parse?> d, IHeadRules rules, ParserEventTypeEnum etype, Dictionary? dict = null)

Parameters

d IObjectStream<Parse>
rules IHeadRules
etype ParserEventTypeEnum
dict Dictionary

Fields

dict

protected Dictionary? dict

Field Value

Dictionary

etype

The type of events being generated by this event stream.

protected ParserEventTypeEnum etype

Field Value

ParserEventTypeEnum

fixPossesives

protected bool fixPossesives

Field Value

bool

punctSet

protected ISet<string> punctSet

Field Value

ISet<string>

rules

protected IHeadRules rules

Field Value

IHeadRules

Methods

AddParseEvents(IList<Event>, Parse[])

Produces all events for the specified sentence chunks and adds them to the specified list.

protected abstract void AddParseEvents(IList<Event> newEvents, Parse[] chunks)

Parameters

newEvents IList<Event>

A list of events to be added to.

chunks Parse[]

Pre-chunked constituents of a sentence.

CreateEvents(Parse)

Creates events for the provided sample.

protected override IEnumerable<Event> CreateEvents(Parse sample)

Parameters

sample Parse

the sample for which training Events are be created.

Returns

IEnumerable<Event>

a sequence of training events, or an empty sequence.

Remarks

NOpenNLP: upstream returns an Iterator<Event>. This returns IEnumerable<T> instead, which is the more usual .NET shape and spares implementers from handing back an enumerator the caller must dispose. Read() enumerates it manually, since it yields one event per call.

GetInitialChunks(Parse)

public static Parse[] GetInitialChunks(Parse p)

Parameters

p Parse

Returns

Parse[]

Init()

protected virtual void Init()

LastChild(Parse, Parse)

Returns true if the specified child is the last child of the specified parent.

protected virtual bool LastChild(Parse child, Parse parent)

Parameters

child Parse

The child parse.

parent Parse

The parent parse.

Returns

bool

true if the specified child is the last child of the specified parent; false otherwise.