Package opennlp.tools.namefind
Class NameFinderEventStream
- All Implemented Interfaces:
AutoCloseable,ObjectStream<Event>
Class for creating an event stream out of data files for training an name
finder.
-
Constructor Summary
ConstructorsConstructorDescriptionNameFinderEventStream(ObjectStream<NameSample> dataStream) NameFinderEventStream(ObjectStream<NameSample> dataStream, String type, NameContextGenerator contextGenerator, SequenceCodec<String> codec) Creates a new name finder event stream using the specified data stream and context generator. -
Method Summary
Modifier and TypeMethodDescriptionstatic String[][]additionalContext(String[] tokens, Map<String, String> prevMap) Generated previous decision features for each token based on contents of the specified map.generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) static String[]generateOutcomes(Span[] names, String type, int length) Deprecated.use the BioCodec implementation of the SequenceValidator instead!Methods inherited from class opennlp.tools.util.AbstractEventStream
close, read, reset
-
Constructor Details
-
NameFinderEventStream
public NameFinderEventStream(ObjectStream<NameSample> dataStream, String type, NameContextGenerator contextGenerator, SequenceCodec<String> codec) Creates a new name finder event stream using the specified data stream and context generator.- Parameters:
dataStream- The data stream of events.type- null or overrides the type parameter in the provided samplescontextGenerator- The context generator used to generate features for the event stream.
-
NameFinderEventStream
-
-
Method Details
-
generateOutcomes
Deprecated.use the BioCodec implementation of the SequenceValidator instead!Generates the name tag outcomes (start, continue, other) for each token in a sentence with the specified length using the specified name spans.- Parameters:
names- Token spans for each of the names.type- null or overrides the type parameter in the provided sampleslength- The length of the sentence.- Returns:
- An array of start, continue, other outcomes based on the specified names and sentence length.
-
generateEvents
public static List<Event> generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) -
additionalContext
Generated previous decision features for each token based on contents of the specified map.- Parameters:
tokens- The token for which the context is generated.prevMap- A mapping of tokens to their previous decisions.- Returns:
- An additional context array with features for each token.
-