Class ChunkerEventStream

Namespace
NOpenNLP.Tools.Chunker
Assembly
NOpenNLP.Tools.dll

Class for creating an event stream out of data files for training a chunker.

public class ChunkerEventStream : AbstractEventStream<ChunkSample>, IObjectStream<Event?>, IDisposable
Inheritance
ChunkerEventStream
Implements
Inherited Members

Constructors

ChunkerEventStream(IObjectStream<ChunkSample?>, IChunkerContextGenerator)

Creates a new event stream based on the specified data stream using the specified context generator.

public ChunkerEventStream(IObjectStream<ChunkSample?> d, IChunkerContextGenerator cg)

Parameters

d IObjectStream<ChunkSample>

The data stream for this event stream.

cg IChunkerContextGenerator

The context generator which should be used in the creation of events for this event stream.

Methods

CreateEvents(ChunkSample)

Creates events for the provided sample.

protected override IEnumerable<Event> CreateEvents(ChunkSample sample)

Parameters

sample ChunkSample

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.