public abstract class AbstractLinker extends Object implements Linker
Modifier and Type | Field and Description |
---|---|
protected String |
corefProject
The name of the project where the coreference models are stored.
|
protected boolean |
debug
Specifies whether debug print is generated.
|
protected DiscourseEntity[] |
entities
Array used to store the results of each call made to the linker.
|
protected HeadFinder |
headFinder
The head finder used in this linker.
|
protected static Linker |
linker
Instance used for for returning the same linker for subsequent getInstance requests.
|
protected MentionFinder |
mentionFinder
The mention finder used to find mentions.
|
protected LinkerMode |
mode
The mode in which this linker is running.
|
protected boolean |
removeUnresolvedMentions
Specifies whether mentions for which no resolver can be used should be added to the
discourse model.
|
protected String[] |
resolverNames
The names of the resolvers used by this Linker.
|
protected AbstractResolver[] |
resolvers
The resolvers used by this Linker.
|
protected int |
SINGULAR_PRONOUN
The index of resolver which is used for singular pronouns.
|
protected boolean |
useDiscourseModel
Specifies whether coreferent mentions should be combined into a single entity.
|
COMBINED_NPS, DESCRIPTOR, ISA, NP, PRONOUN_MODIFIER, PROPER_NOUN_MODIFIER
Constructor and Description |
---|
AbstractLinker(String project,
LinkerMode mode)
Creates a new linker using the models in the specified project directory and using the specified mode.
|
AbstractLinker(String project,
LinkerMode mode,
boolean useDiscourseModel)
Creates a new linker using the models in the specified project directory, using the specified mode,
and combining coreferent entities based on the specified value.
|
Modifier and Type | Method and Description |
---|---|
protected DiscourseEntity |
checkForMerges(DiscourseModel dm,
DiscourseEntity[] des) |
protected abstract Gender |
computeGender(MentionContext mention) |
protected abstract Number |
computeNumber(MentionContext mention) |
MentionContext[] |
constructMentionContexts(Mention[] mentions)
Creates mention contexts for the specified mention exents.
|
DiscourseEntity[] |
getEntities(Mention[] mentions)
Returns a list of entities which group the mentions into entity classes.
|
HeadFinder |
getHeadFinder()
Returns the head finder associated with this linker.
|
MentionFinder |
getMentionFinder()
Returns the mention finder for this linker.
|
protected void |
resolve(MentionContext mention,
DiscourseModel discourseModel)
Resolves the specified mention to an entity in the specified discourse model or creates a new entity for the mention.
|
void |
setEntities(Mention[] mentions)
Indicated that the specified mentions can be used to train this linker.
|
void |
train()
Trains the linker based on the data specified via calls to
setEntities . |
protected void |
updateExtent(DiscourseModel dm,
MentionContext mention,
DiscourseEntity entity,
boolean useDiscourseModel)
Updates the specified discourse model with the specified mention as coreferent with the specified entity.
|
protected MentionFinder mentionFinder
protected boolean debug
protected LinkerMode mode
protected static Linker linker
protected AbstractResolver[] resolvers
protected String[] resolverNames
protected DiscourseEntity[] entities
protected int SINGULAR_PRONOUN
protected String corefProject
protected HeadFinder headFinder
protected boolean useDiscourseModel
protected boolean removeUnresolvedMentions
public AbstractLinker(String project, LinkerMode mode)
project
- The location of the models or other data needed by this linker.mode
- The mode the linker should be run in: testing, training, or evaluation.public AbstractLinker(String project, LinkerMode mode, boolean useDiscourseModel)
project
- The location of the models or other data needed by this linker.mode
- The mode the linker should be run in: testing, training, or evaluation.useDiscourseModel
- Specifies whether coreferent mention should be combined or not.protected void resolve(MentionContext mention, DiscourseModel discourseModel)
mention
- The mention to resolve.discourseModel
- The discourse model of existing entities.public HeadFinder getHeadFinder()
Linker
getHeadFinder
in interface Linker
protected void updateExtent(DiscourseModel dm, MentionContext mention, DiscourseEntity entity, boolean useDiscourseModel)
dm
- The discourse modelmention
- The mention to be added to the specified entity.entity
- The entity which is mentioned by the specified mention.useDiscourseModel
- Whether the mentions should be kept as an entiy or simply co-indexed.protected DiscourseEntity checkForMerges(DiscourseModel dm, DiscourseEntity[] des)
public DiscourseEntity[] getEntities(Mention[] mentions)
Linker
getEntities
in interface Linker
mentions
- A array of mentions.public void setEntities(Mention[] mentions)
Linker
setEntities
in interface Linker
mentions
- The mentions to be used to train the linker.public void train() throws IOException
Linker
setEntities
.train
in interface Linker
IOException
public MentionFinder getMentionFinder()
Linker
getMentionFinder
in interface Linker
public MentionContext[] constructMentionContexts(Mention[] mentions)
Linker
constructMentionContexts
in interface Linker
mentions
- The mention of a document.protected abstract Gender computeGender(MentionContext mention)
protected abstract Number computeNumber(MentionContext mention)
Copyright © 2016 The Apache Software Foundation. All rights reserved.