opennlp.tools.namefind
Class NameFinderEventStream
java.lang.Object
opennlp.model.AbstractEventStream
opennlp.tools.namefind.NameFinderEventStream
- All Implemented Interfaces:
- EventStream
public class NameFinderEventStream
- extends AbstractEventStream
Class for creating an event stream out of data files for training an name
finder.
Method Summary |
static java.lang.String[][] |
additionalContext(java.lang.String[] tokens,
java.util.Map<java.lang.String,java.lang.String> prevMap)
Generated previous decision features for each token based on contents of the specified map. |
static java.lang.String[] |
generateOutcomes(Span[] names,
java.lang.String type,
int length)
Generates the name tag outcomes (start, continue, other) for each token in a sentence
with the specified length using the specified name spans. |
boolean |
hasNext()
|
static void |
main(java.lang.String[] args)
|
Event |
next()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NameFinderEventStream
public NameFinderEventStream(ObjectStream<NameSample> dataStream,
java.lang.String type,
NameContextGenerator contextGenerator)
- 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
public NameFinderEventStream(ObjectStream<NameSample> dataStream)
generateOutcomes
public static java.lang.String[] generateOutcomes(Span[] names,
java.lang.String type,
int length)
- 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.
hasNext
public boolean hasNext()
throws java.io.IOException
- Throws:
java.io.IOException
next
public Event next()
additionalContext
public static java.lang.String[][] additionalContext(java.lang.String[] tokens,
java.util.Map<java.lang.String,java.lang.String> prevMap)
- 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.
main
public static final void main(java.lang.String[] args)
throws java.io.IOException
- Throws:
java.io.IOException
Copyright © 2011 The Apache Software Foundation. All Rights Reserved.