opennlp.tools.coref
Class AbstractLinker

java.lang.Object
  extended by opennlp.tools.coref.AbstractLinker
All Implemented Interfaces:
Linker
Direct Known Subclasses:
DefaultLinker

public abstract class AbstractLinker
extends Object
implements Linker

Provides a default implementation of many of the methods in Linker that most implementations of Linker will want to extend.


Field Summary
 
Fields inherited from interface opennlp.tools.coref.Linker
COMBINED_NPS, DESCRIPTOR, ISA, NP, PRONOUN_MODIFIER, PROPER_NOUN_MODIFIER
 
Constructor Summary
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.
 
Method Summary
 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.
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractLinker

public AbstractLinker(String project,
                      LinkerMode mode)
Creates a new linker using the models in the specified project directory and using the specified mode.

Parameters:
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.

AbstractLinker

public 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.

Parameters:
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.
Method Detail

getHeadFinder

public HeadFinder getHeadFinder()
Description copied from interface: Linker
Returns the head finder associated with this linker.

Specified by:
getHeadFinder in interface Linker
Returns:
The head finder associated with this linker.

getEntities

public DiscourseEntity[] getEntities(Mention[] mentions)
Description copied from interface: Linker
Returns a list of entities which group the mentions into entity classes.

Specified by:
getEntities in interface Linker
Parameters:
mentions - A array of mentions.
Returns:
An array of discourse entities.

setEntities

public void setEntities(Mention[] mentions)
Description copied from interface: Linker
Indicated that the specified mentions can be used to train this linker. This requires that the coreference relationship between the mentions have been labeled in the mention's id field.

Specified by:
setEntities in interface Linker
Parameters:
mentions - The mentions to be used to train the linker.

train

public void train()
           throws IOException
Description copied from interface: Linker
Trains the linker based on the data specified via calls to setEntities.

Specified by:
train in interface Linker
Throws:
IOException

getMentionFinder

public MentionFinder getMentionFinder()
Description copied from interface: Linker
Returns the mention finder for this linker. This can be used to get the mentions of a Parse.

Specified by:
getMentionFinder in interface Linker
Returns:
The object which finds mentions for this linker.

constructMentionContexts

public MentionContext[] constructMentionContexts(Mention[] mentions)
Description copied from interface: Linker
Creates mention contexts for the specified mention exents. These are used to compute coreference features over.

Specified by:
constructMentionContexts in interface Linker
Parameters:
mentions - The mention of a document.
Returns:
mention contexts for the specified mention exents.


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.