|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectopennlp.tools.coref.resolver.AbstractResolver
opennlp.tools.coref.resolver.MaxentResolver
public abstract class MaxentResolver
Provides common functionality used by classes which implement the Resolver class and use maximum entropy models to make resolution decisions.
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT
Default feature value. |
static java.lang.String |
DIFF
Outcome when two mentions are not corefernt. |
protected NonReferentialResolver |
nonReferentialResolver
The model for computing non-referential probabilities. |
protected boolean |
pairedSampleSelection
When true, this designates that training should consist of a single positive and a single negitive example (when possible) for each mention. |
protected boolean |
preferFirstReferent
When true, this designates that the resolver should use the first referent encountered which it more preferable than non-reference. |
static java.lang.String |
SAME
Outcomes when two mentions are coreferent. |
protected boolean |
useSameModelForNonRef
When true, this designates that the same maximum entropy model should be used non-reference events (the pairing of a mention and the "null" reference) as is used for potentially referential pairs. |
| Fields inherited from class opennlp.tools.coref.resolver.AbstractResolver |
|---|
distances, numEntitiesBack, numSentencesBack, showExclusions |
| Constructor Summary | |
|---|---|
protected |
MaxentResolver(int numberOfEntitiesBack,
boolean preferFirstReferent)
Creates a maximum-entropy-based resolver which will look the specified number of entities back for a referent. |
|
MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack)
Creates a maximum-entropy-based resolver with the specified model name, using the specified mode, which will look the specified number of entities back for a referent. |
|
MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack,
boolean preferFirstReferent)
|
|
MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack,
boolean preferFirstReferent,
double nonReferentialProbability)
|
|
MaxentResolver(java.lang.String modelDirectory,
java.lang.String name,
ResolverMode mode,
int numberOfEntitiesBack,
boolean preferFirstReferent,
NonReferentialResolver nonReferentialResolver)
Creates a maximum-entropy-based resolver with the specified model name, using the specified mode, which will look the specified number of entities back for a referent and prefer the first referent if specified. |
|
MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack,
NonReferentialResolver nonReferentialResolver)
|
| Method Summary | |
|---|---|
protected boolean |
defaultReferent(DiscourseEntity de)
Returns whether the specified entity satisfies the criteria for being a default referent. |
protected boolean |
definiteArticle(java.lang.String tok,
java.lang.String tag)
Returns whether the specified token is a definite article. |
protected boolean |
excluded(MentionContext ec,
DiscourseEntity de)
Excludes entities which you are not compatible with the entity under consideration. |
static java.util.List |
getContextFeatures(MentionContext mention)
Returns a list of features based on the surrounding context of the specified mention. |
protected java.util.List |
getDistanceFeatures(MentionContext mention,
DiscourseEntity entity)
Returns distance features for the specified mention and entity. |
protected java.util.List |
getFeatures(MentionContext mention,
DiscourseEntity entity)
Returns a list of features for deciding whether the specificed mention refers to the specified discourse entity. |
protected java.lang.String |
getMentionCountFeature(DiscourseEntity de)
|
protected java.util.List |
getPronounMatchFeatures(MentionContext mention,
DiscourseEntity entity)
Returns features indicating whether the specified mention is compatible with the pronouns of the specified entity. |
protected java.util.List |
getStringMatchFeatures(MentionContext mention,
DiscourseEntity entity)
Returns string-match features for the the specified mention and entity. |
static java.util.List |
getWordFeatures(Parse token)
Returns a list of word features for the specified tokens. |
static boolean |
loadAsResource()
Returns whether the models should be loaded from a file or from a resource. |
static void |
loadAsResource(boolean lar)
Specifies whether the models should be loaded from a resource. |
DiscourseEntity |
resolve(MentionContext ec,
DiscourseModel dm)
Resolve this refering extression to a discourse entity in the discourse model. |
DiscourseEntity |
retain(MentionContext mention,
DiscourseModel dm)
Uses the specified mention and discourse model to train this resolver. |
static void |
setSimilarityModel(TestSimilarityModel sm)
|
void |
train()
Retrains model on examples for which retain was called. |
| Methods inherited from class opennlp.tools.coref.resolver.AbstractResolver |
|---|
featureString, getHead, getHeadIndex, getHeadString, getNumEntities, getNumEntities, getPronounGender, outOfRange, setNumberSentencesBack, stripNp |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface opennlp.tools.coref.resolver.Resolver |
|---|
canResolve |
| Field Detail |
|---|
public static final java.lang.String SAME
public static final java.lang.String DIFF
public static final java.lang.String DEFAULT
protected boolean preferFirstReferent
protected boolean pairedSampleSelection
protected boolean useSameModelForNonRef
protected NonReferentialResolver nonReferentialResolver
| Constructor Detail |
|---|
protected MaxentResolver(int numberOfEntitiesBack,
boolean preferFirstReferent)
numberOfEntitiesBack - preferFirstReferent -
public MaxentResolver(java.lang.String modelDirectory,
java.lang.String name,
ResolverMode mode,
int numberOfEntitiesBack,
boolean preferFirstReferent,
NonReferentialResolver nonReferentialResolver)
throws java.io.IOException
modelDirectory - The name of the directory where the resover models are stored.name - The name of the file where this model will be read or written.mode - The mode this resolver is being using in (training, testing).numberOfEntitiesBack - The number of entities back in the text that this resolver will look
for a referent.preferFirstReferent - Set to true if the resolver should prefer the first referent which is more
likly than non-reference. This only affects testing.nonReferentialResolver - Determines how likly it is that this entity is non-referential.
java.io.IOException - If the model file is not found or can not be written to.
public MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack)
throws java.io.IOException
modelDirectory - The name of the directory where the resover models are stored.modelName - The name of the file where this model will be read or written.mode - The mode this resolver is being using in (training, testing).numberEntitiesBack - The number of entities back in the text that this resolver will look
for a referent.
java.io.IOException - If the model file is not found or can not be written to.
public MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack,
NonReferentialResolver nonReferentialResolver)
throws java.io.IOException
java.io.IOException
public MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack,
boolean preferFirstReferent)
throws java.io.IOException
java.io.IOException
public MaxentResolver(java.lang.String modelDirectory,
java.lang.String modelName,
ResolverMode mode,
int numberEntitiesBack,
boolean preferFirstReferent,
double nonReferentialProbability)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public static void loadAsResource(boolean lar)
lar - boolean which if true indicates that the model should be loaded as a resource.public static boolean loadAsResource()
public DiscourseEntity resolve(MentionContext ec,
DiscourseModel dm)
Resolver
ec - the refering expression.dm - the discourse model.
protected boolean defaultReferent(DiscourseEntity de)
de - The discourse entity being considered for non-reference.
public DiscourseEntity retain(MentionContext mention,
DiscourseModel dm)
Resolver
retain in interface Resolverretain in class AbstractResolvermention - The mention which is being used for training.dm - the discourse model.
protected java.lang.String getMentionCountFeature(DiscourseEntity de)
protected java.util.List getFeatures(MentionContext mention,
DiscourseEntity entity)
mention - the mention being considers as possibly referential.entity - The disource entity with which the mention is being considered referential.
public void train()
throws java.io.IOException
Resolver
train in interface Resolvertrain in class AbstractResolverjava.io.IOExceptionpublic static void setSimilarityModel(TestSimilarityModel sm)
public static java.util.List getContextFeatures(MentionContext mention)
mention - he mention whose surround context the features model.
protected boolean definiteArticle(java.lang.String tok,
java.lang.String tag)
tok - The token.tag - The pos-tag for the specified token.
protected boolean excluded(MentionContext ec,
DiscourseEntity de)
AbstractResolver
excluded in class AbstractResolverec - The mention which is being considered as referential.de - The entity to which the mention is to be resolved.
protected java.util.List getDistanceFeatures(MentionContext mention,
DiscourseEntity entity)
mention - The mention.entity - The entity.
protected java.util.List getPronounMatchFeatures(MentionContext mention,
DiscourseEntity entity)
mention - The mention.entity - The entity.
protected java.util.List getStringMatchFeatures(MentionContext mention,
DiscourseEntity entity)
mention - The mention.entity - The entity.
public static java.util.List getWordFeatures(Parse token)
token - The token for which fetures are to be computed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||