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 
TokenNameFinder.- 
Constructor SummaryConstructorsConstructorDescriptionNameFinderEventStream(ObjectStream<NameSample> dataStream, String type, NameContextGenerator contextGenerator, SequenceCodec<String> codec) 
- 
Method SummaryModifier and TypeMethodDescriptionstatic String[][]additionalContext(String[] tokens, Map<String, String> prevMap) Generated previous decision features for each token based on contents of the specifiedprevMap.generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) Generateseventsfor each token in asentencewith the specifiedoutcomesusing the specifiedNameContextGenerator.static String[]generateOutcomes(Span[] names, String type, int length) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class opennlp.tools.util.AbstractEventStreamclose, read, reset
- 
Constructor Details- 
NameFinderEventStreampublic NameFinderEventStream(ObjectStream<NameSample> dataStream, String type, NameContextGenerator contextGenerator, SequenceCodec<String> codec) - Parameters:
- dataStream- The- data streamof events.
- type-- nullor overrides the type parameter in the provided samples.
- contextGenerator- The- NameContextGeneratorused to generate features for the event stream.
- codec- The- SequenceCodecto use.
 
 
- 
- 
Method Details- 
generateOutcomes@Deprecated(forRemoval=true) public static String[] generateOutcomes(Span[] names, String type, int length) Deprecated, for removal: This API element is subject to removal in a future version.use theBioCodecimplementation of the SequenceValidator instead!Generates the name tag outcomes (start,continue,other) for each token in a sentence with the specifiedlengthusing the specifiednames.- Parameters:
- names- Token- spansfor each of the names.
- type-- nullor overrides the type parameter in the provided samples
- length- The length of the sentence.
- Returns:
- An array of start,continue,otheroutcomes based on the specified names and sentencelength.
 
- 
generateEventspublic static List<Event> generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) Generateseventsfor each token in asentencewith the specifiedoutcomesusing the specifiedNameContextGenerator.- Parameters:
- sentence- Token representing a sentence.
- outcomes- An array of outcomes.
- cg- The- NameContextGeneratorto use.
- Returns:
- A list of eventsgenerated.
 
- 
additionalContextGenerated previous decision features for each token based on contents of the specifiedprevMap.- Parameters:
- tokens- The token for which the context is generated.
- prevMap- A mapping of tokens to their previous decisions.
- Returns:
- A 2-dimensional array with additional context with features for each token.
 
 
- 
BioCodecimplementation of the SequenceValidator instead!