edu.illinois.cs.cogcomp.lbj.coref.decoders
Class CorefKeyDecoder

java.lang.Object
  extended by edu.illinois.cs.cogcomp.lbj.coref.decoders.DecoderWithOptions<ChainSolution<CT>>
      extended by edu.illinois.cs.cogcomp.lbj.coref.decoders.KeyChainDecoder<Mention>
          extended by edu.illinois.cs.cogcomp.lbj.coref.decoders.CorefKeyDecoder
All Implemented Interfaces:
KeyDecoder<ChainSolution<Mention>>, SolutionDecoder<ChainSolution<Mention>>

public class CorefKeyDecoder
extends KeyChainDecoder<Mention>

A decoder that extracts the true entities of a document and encodes them in a ChainSolution. Provides facility for filtering some of those mentions.

Author:
Eric Bengtson

Field Summary
private  boolean m_allMents
          Whether all predicted mentions should be added to the solution.
private  boolean m_bBothMustAccept
          Whether a pair of mentions must both be accepted to link them.
private  MFilter m_m2Filter
          This filter should be m_mFilter if only one filter needed.
private  MFilter m_mFilter
          The first filter, which may be null if no filtering is desired.
 
Fields inherited from class edu.illinois.cs.cogcomp.lbj.coref.decoders.DecoderWithOptions
m_options, m_train
 
Constructor Summary
CorefKeyDecoder()
          Construct a decoder that does not filter but adds all predicted mentions to the resulting solution.
CorefKeyDecoder(MFilter filter)
          Constructor that accepts a single mention filter and requires that a pair of mentions both be accepted for the pair to be linked in the solution.
CorefKeyDecoder(MFilter filter, boolean bothMustAccept)
          Constructor that accepts a single mention filter
CorefKeyDecoder(MFilter filter, boolean bothMustAccept, boolean allMents)
          Constructor that accepts a single mention filter
CorefKeyDecoder(MFilter m1Filter, MFilter m2Filter)
          Constructs a decoder that accepts two filters.
CorefKeyDecoder(MFilter m1Filter, MFilter m2Filter, boolean allMents)
          Constructs a decoder that accepts two filters.
 
Method Summary
 ChainSolution<Mention> decode(Doc doc)
          Extract the entities from a document and encode the parts that are accepted by any optional filters into a ChainSolution representing those entities.
private  boolean doAccept(Mention m1, Mention m2)
          Determine whether filter(s) accept the mentions.
protected  void oneFilterEntity(ChainSolution<Mention> sol, Entity ent)
          Adds the mentions of the provided entity that are accepted by the (first) filter as a chain in the solution.
protected  void twoFilterEntity(ChainSolution<Mention> sol, Entity ent)
          Links every pair of mentions of the provided entity that are accepted by the filter(s).
protected  void zeroFilterEntity(ChainSolution<Mention> sol, Entity ent)
          Adds the mentions in the provided entity as a chain in the solution.
 
Methods inherited from class edu.illinois.cs.cogcomp.lbj.coref.decoders.DecoderWithOptions
getBooleanOption, getOption, getRealOption, processOption, setOption, setOption, setOption, setTrain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface edu.illinois.cs.cogcomp.lbj.coref.decoders.SolutionDecoder
setOption
 

Field Detail

m_mFilter

private MFilter m_mFilter
The first filter, which may be null if no filtering is desired.


m_m2Filter

private MFilter m_m2Filter
This filter should be m_mFilter if only one filter needed.


m_bBothMustAccept

private boolean m_bBothMustAccept
Whether a pair of mentions must both be accepted to link them.


m_allMents

private boolean m_allMents
Whether all predicted mentions should be added to the solution.

Constructor Detail

CorefKeyDecoder

public CorefKeyDecoder()
Construct a decoder that does not filter but adds all predicted mentions to the resulting solution.


CorefKeyDecoder

public CorefKeyDecoder(MFilter filter)
Constructor that accepts a single mention filter and requires that a pair of mentions both be accepted for the pair to be linked in the solution.

Parameters:
filter - The mention filter.

CorefKeyDecoder

public CorefKeyDecoder(MFilter filter,
                       boolean bothMustAccept)
Constructor that accepts a single mention filter

Parameters:
filter - A mention filter.
bothMustAccept - If true, a pair of mentions in a entity must both be accepted by the filter for the pair to be linked, otherwise, any pair where at least one mention is accepted by the filter will be linked.

CorefKeyDecoder

public CorefKeyDecoder(MFilter filter,
                       boolean bothMustAccept,
                       boolean allMents)
Constructor that accepts a single mention filter

Parameters:
filter - A mention filter.
bothMustAccept - If true, a pair of mentions in a entity must both be accepted by the filter for the pair to be linked, otherwise, any pair where at least one mention is accepted by the filter will be linked.
allMents - Whether to add all predicted mentions to the solution.

CorefKeyDecoder

public CorefKeyDecoder(MFilter m1Filter,
                       MFilter m2Filter,
                       boolean allMents)
Constructs a decoder that accepts two filters. Since an entity represents an unordered set of mentions, the order of the filters is irrelevant. A pair of mentions must be accepted by both filters (in some order) for them to be linked. If a single mention is accepted by both filters, it will be included in the solution.

Parameters:
m1Filter - One filter, which should not be null.
m2Filter - Another filter, which should not be null.
allMents - Whether to add all predicted mentions to the solution.

CorefKeyDecoder

public CorefKeyDecoder(MFilter m1Filter,
                       MFilter m2Filter)
Constructs a decoder that accepts two filters. Since an entity represents an unordered set of mentions, the order of the filters is irrelevant. A pair of mentions must be accepted by both filters (in some order) for them to be linked. If a single mention is accepted by both filters, it will be included in the solution. All predicted mentions will be added to the solution.

Parameters:
m1Filter - One filter, which should not be null.
m2Filter - Another filter, which should not be null.
Method Detail

decode

public ChainSolution<Mention> decode(Doc doc)
Extract the entities from a document and encode the parts that are accepted by any optional filters into a ChainSolution representing those entities.

Specified by:
decode in interface KeyDecoder<ChainSolution<Mention>>
Specified by:
decode in interface SolutionDecoder<ChainSolution<Mention>>
Specified by:
decode in class KeyChainDecoder<Mention>
Parameters:
doc - The document whose entities to extract.
Returns:
A ChainSolution representing entities as chains of mentions.

zeroFilterEntity

protected void zeroFilterEntity(ChainSolution<Mention> sol,
                                Entity ent)
Adds the mentions in the provided entity as a chain in the solution. Does not apply any filters. Modifies the solution in place.

Parameters:
sol - The solution, to be modified in place.
ent - The entity whose mentions should be placed in a chain.

oneFilterEntity

protected void oneFilterEntity(ChainSolution<Mention> sol,
                               Entity ent)
Adds the mentions of the provided entity that are accepted by the (first) filter as a chain in the solution. Modifies the solution in place.

Parameters:
sol - The solution, to be modified in place.
ent - The entity whose mentions should be placed in a chain.

twoFilterEntity

protected void twoFilterEntity(ChainSolution<Mention> sol,
                               Entity ent)
Links every pair of mentions of the provided entity that are accepted by the filter(s). Modifies the solution in place.

Parameters:
sol - The solution, to be modified in place.
ent - The entity whose mentions should be linked.

doAccept

private boolean doAccept(Mention m1,
                         Mention m2)
Determine whether filter(s) accept the mentions.

Parameters:
m1 - One mention.
m2 - Another mention.
Returns:
Whether the filter(s) accept the mentions, in order.