|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopennlp.tools.namefind.NameFinderME
public class NameFinderME
Class for creating a maximum-entropy-based name finder.
Field Summary | |
---|---|
static java.lang.String |
CONTINUE
|
static int |
DEFAULT_BEAM_SIZE
|
static java.lang.String |
OTHER
|
static java.lang.String |
START
|
Constructor Summary | |
---|---|
NameFinderME(MaxentModel mod)
Deprecated. Use the new model API! |
|
NameFinderME(MaxentModel mod,
NameContextGenerator cg)
Deprecated. |
|
NameFinderME(MaxentModel mod,
NameContextGenerator cg,
int beamSize)
Deprecated. |
|
NameFinderME(TokenNameFinderModel model)
|
|
NameFinderME(TokenNameFinderModel model,
AdaptiveFeatureGenerator generator,
int beamSize)
Initializes the name finder with the specified model. |
|
NameFinderME(TokenNameFinderModel model,
int beamSize)
|
Method Summary | |
---|---|
void |
clearAdaptiveData()
Forgets all adaptive data which was collected during previous calls to one of the find methods. |
static Span[] |
dropOverlappingSpans(Span[] spans)
Removes spans with are intersecting or crossing in anyway. |
Span[] |
find(java.lang.String[] tokens)
Generates name tags for the given sequence, typically a sentence, returning token spans for any identified names. |
Span[] |
find(java.lang.String[] tokens,
java.lang.String[][] additionalContext)
Generates name tags for the given sequence, typically a sentence, returning token spans for any identified names. |
static void |
main(java.lang.String[] args)
Deprecated. |
double[] |
probs()
Returns an array with the probabilities of the last decoded sequence. |
void |
probs(double[] probs)
Populates the specified array with the probabilities of the last decoded sequence. |
double[] |
probs(Span[] spans)
Returns an array of probabilities for each of the specified spans which is the product the probabilities for each of the outcomes which make up the span. |
static GISModel |
train(EventStream es,
int iterations,
int cut)
Deprecated. |
static TokenNameFinderModel |
train(java.lang.String languageCode,
java.lang.String type,
ObjectStream<NameSample> samples,
AdaptiveFeatureGenerator generator,
java.util.Map<java.lang.String,java.lang.Object> resources,
int iterations,
int cutoff)
Trains a name finder model. |
static TokenNameFinderModel |
train(java.lang.String languageCode,
java.lang.String type,
ObjectStream<NameSample> samples,
java.util.Map<java.lang.String,java.lang.Object> resources)
|
static TokenNameFinderModel |
train(java.lang.String languageCode,
java.lang.String type,
ObjectStream<NameSample> samples,
java.util.Map<java.lang.String,java.lang.Object> resources,
int iterations,
int cutoff)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BEAM_SIZE
public static final java.lang.String START
public static final java.lang.String CONTINUE
public static final java.lang.String OTHER
Constructor Detail |
---|
public NameFinderME(TokenNameFinderModel model)
public NameFinderME(TokenNameFinderModel model, AdaptiveFeatureGenerator generator, int beamSize)
model
- beamSize
- public NameFinderME(TokenNameFinderModel model, int beamSize)
@Deprecated public NameFinderME(MaxentModel mod)
mod
- The model to be used to find names.@Deprecated public NameFinderME(MaxentModel mod, NameContextGenerator cg)
mod
- The model to be used to find names.cg
- The context generator to be used with this name finder.@Deprecated public NameFinderME(MaxentModel mod, NameContextGenerator cg, int beamSize)
mod
- The model to be used to find names.cg
- The context generator to be used with this name finder.beamSize
- The size of the beam to be used in decoding this model.Method Detail |
---|
public Span[] find(java.lang.String[] tokens)
TokenNameFinder
find
in interface TokenNameFinder
tokens
- an array of the tokens or words of the sequence, typically a sentence.
public Span[] find(java.lang.String[] tokens, java.lang.String[][] additionalContext)
tokens
- an array of the tokens or words of the sequence,
typically a sentence.additionalContext
- features which are based on context outside
of the sentence but which should also be used.
public void clearAdaptiveData()
clearAdaptiveData
in interface TokenNameFinder
public void probs(double[] probs)
chunk
. The specified array should be at least as large as
the number of tokens in the previous call to chunk
.
probs
- An array used to hold the probabilities of the last decoded
sequence.public double[] probs()
chunk
.
chunk
when it was last called.public double[] probs(Span[] spans)
spans
- The spans of the names for which probabilities are desired.
public static TokenNameFinderModel train(java.lang.String languageCode, java.lang.String type, ObjectStream<NameSample> samples, AdaptiveFeatureGenerator generator, java.util.Map<java.lang.String,java.lang.Object> resources, int iterations, int cutoff) throws java.io.IOException
languageCode
- the language of the training datatype
- null or an override type for all types in the training datasamples
- the training dataiterations
- the number of iterationscutoff
- resources
- the resources for the name finder or null if none
java.io.IOException
java.io.ObjectStreamException
public static TokenNameFinderModel train(java.lang.String languageCode, java.lang.String type, ObjectStream<NameSample> samples, java.util.Map<java.lang.String,java.lang.Object> resources, int iterations, int cutoff) throws java.io.IOException
java.io.IOException
public static TokenNameFinderModel train(java.lang.String languageCode, java.lang.String type, ObjectStream<NameSample> samples, java.util.Map<java.lang.String,java.lang.Object> resources) throws java.io.IOException
java.io.IOException
@Deprecated public static GISModel train(EventStream es, int iterations, int cut) throws java.io.IOException
java.io.IOException
public static Span[] dropOverlappingSpans(Span[] spans)
The following rules are used to remove the spans:
Identical spans: The first span in the array after sorting it remains
Intersecting spans: The first span after sorting remains
Contained spans: All spans which are contained by another are removed
spans
-
@Deprecated public static void main(java.lang.String[] args) throws java.io.IOException
args
- [-encoding encoding] training_file model_file
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |