public class NameFinderEventStream extends AbstractEventStream<NameSample>
Constructor and Description |
---|
NameFinderEventStream(ObjectStream<NameSample> dataStream) |
NameFinderEventStream(ObjectStream<NameSample> dataStream,
String type,
NameContextGenerator contextGenerator)
Creates a new name finder event stream using the specified data stream and context generator.
|
Modifier and Type | Method and Description |
---|---|
static String[][] |
additionalContext(String[] tokens,
Map<String,String> prevMap)
Generated previous decision features for each token based on contents of the specified map.
|
protected Iterator<Event> |
createEvents(NameSample sample)
Creates events for the provided sample.
|
static List<Event> |
generateEvents(String[] sentence,
String[] outcomes,
NameContextGenerator cg) |
static String[] |
generateOutcomes(Span[] names,
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.
|
static void |
main(String[] args)
Deprecated.
|
hasNext, next
remove
public NameFinderEventStream(ObjectStream<NameSample> dataStream, String type, NameContextGenerator contextGenerator)
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.public NameFinderEventStream(ObjectStream<NameSample> dataStream)
public static String[] generateOutcomes(Span[] names, String type, int length)
names
- Token spans for each of the names.type
- null or overrides the type parameter in the provided sampleslength
- The length of the sentence.public static List<Event> generateEvents(String[] sentence, String[] outcomes, NameContextGenerator cg)
protected Iterator<Event> createEvents(NameSample sample)
AbstractEventStream
createEvents
in class AbstractEventStream<NameSample>
sample
- the sample for which training Event
s
are be created.Iterator
of training events or
an empty Iterator
.public static String[][] additionalContext(String[] tokens, Map<String,String> prevMap)
tokens
- The token for which the context is generated.prevMap
- A mapping of tokens to their previous decisions.@Deprecated public static final void main(String[] args) throws IOException
IOException
Copyright © 2018 The Apache Software Foundation. All rights reserved.