Package opennlp.tools.namefind
Klasse NameFinderEventStream
- Alle implementierten Schnittstellen:
AutoCloseable,ObjectStream<Event>
Class for creating an event stream out of data files for training an
TokenNameFinder.-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungNameFinderEventStream(ObjectStream<NameSample> dataStream, String type, NameContextGenerator contextGenerator, SequenceCodec<String> codec) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic 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) Veraltet, zur Entfernung: Dieses API-Element wird in einer zukünftigen Version entfernt.Von Klasse geerbte Methoden opennlp.tools.util.AbstractEventStream
close, read, reset
-
Konstruktordetails
-
NameFinderEventStream
public NameFinderEventStream(ObjectStream<NameSample> dataStream, String type, NameContextGenerator contextGenerator, SequenceCodec<String> codec) - Parameter:
dataStream- Thedata streamof events.type-nullor overrides the type parameter in the provided samples.contextGenerator- TheNameContextGeneratorused to generate features for the event stream.codec- TheSequenceCodecto use.
-
-
Methodendetails
-
generateOutcomes
@Deprecated(forRemoval=true) public static String[] generateOutcomes(Span[] names, String type, int length) Veraltet, zur Entfernung: Dieses API-Element wird in einer zukünftigen Version entfernt.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.- Parameter:
names- Tokenspansfor each of the names.type-nullor overrides the type parameter in the provided sampleslength- The length of the sentence.- Gibt zurück:
- An array of
start,continue,otheroutcomes based on the specified names and sentencelength.
-
generateEvents
public static List<Event> generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg) Generateseventsfor each token in asentencewith the specifiedoutcomesusing the specifiedNameContextGenerator.- Parameter:
sentence- Token representing a sentence.outcomes- An array of outcomes.cg- TheNameContextGeneratorto use.- Gibt zurück:
- A list of
eventsgenerated.
-
additionalContext
Generated previous decision features for each token based on contents of the specifiedprevMap.- Parameter:
tokens- The token for which the context is generated.prevMap- A mapping of tokens to their previous decisions.- Gibt zurück:
- A 2-dimensional array with additional context with features for each token.
-
BioCodecimplementation of the SequenceValidator instead!