Class AbstractParserEventStream
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
dIObjectStream<Parse>rulesIHeadRulesetypeParserEventTypeEnumdictDictionary
Fields
dict
protected Dictionary? dict
Field Value
etype
The type of events being generated by this event stream.
protected ParserEventTypeEnum etype
Field Value
fixPossesives
protected bool fixPossesives
Field Value
punctSet
protected ISet<string> punctSet
Field Value
rules
protected IHeadRules rules
Field Value
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
newEventsIList<Event>A list of events to be added to.
chunksParse[]Pre-chunked constituents of a sentence.
CreateEvents(Parse)
Creates events for the provided sample.
protected override IEnumerable<Event> CreateEvents(Parse sample)
Parameters
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
pParse
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
Returns
- bool
true if the specified child is the last child of the specified parent; false otherwise.