com.aliasi.coref.matchers
Class SynonymMatch

java.lang.Object
  extended by com.aliasi.coref.BooleanMatcherAdapter
      extended by com.aliasi.coref.matchers.SynonymMatch
All Implemented Interfaces:
Matcher

public class SynonymMatch
extends BooleanMatcherAdapter

Implements a matching function that returns the score specified in the constructor if the mention has a synonym in the mention set as specified by the synonym dictionary. Synonyms are defined over normalized phrases of the mention and the phrases of the mentions in the mention chains. Pairs of synonymous phrases are added to the matcher with the method addSynonym(String,String).

Since:
LingPipe1.0
Version:
3.8
Author:
Bob Carpenter

Field Summary
 
Fields inherited from interface com.aliasi.coref.Matcher
MAX_DISTANCE_SCORE, MAX_SCORE, MAX_SEMANTIC_SCORE, NO_MATCH_SCORE
 
Constructor Summary
SynonymMatch(int score)
          Construct an instance of synonym matching that returns the specified score in the case of a synonym match.
 
Method Summary
 void addSynonym(String phrase1, String phrase2)
          Adds the two phrases as synonyms for one another.
 void clearSynonyms()
          Removes all synonym pairs from this synonym matcher.
 boolean matchBoolean(Mention mention, MentionChain chain)
          Returns true if the mention's normal phrase has a synonym that is the normal phrase of one of the chain's mentions.
 void removeSynonym(String phrase1, String phrase2)
          Ensure sthat the two phrases are no longer synonyms of each other.
 
Methods inherited from class com.aliasi.coref.BooleanMatcherAdapter
match
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynonymMatch

public SynonymMatch(int score)
Construct an instance of synonym matching that returns the specified score in the case of a synonym match.

Parameters:
score - Score to return in case of a match.
Method Detail

matchBoolean

public boolean matchBoolean(Mention mention,
                            MentionChain chain)
Returns true if the mention's normal phrase has a synonym that is the normal phrase of one of the chain's mentions.

Specified by:
matchBoolean in class BooleanMatcherAdapter
Parameters:
mention - Mention to test.
chain - Mention chain to test.
Returns:
true if there is a sequence substring match between the mention and chain.

addSynonym

public void addSynonym(String phrase1,
                       String phrase2)
Adds the two phrases as synonyms for one another. The operation is symmetric, so that they do not need to be added in the reverse order.

Parameters:
phrase1 - First phrase in the synonym pair.
phrase2 - Second phrase in the synonym pair.

removeSynonym

public void removeSynonym(String phrase1,
                          String phrase2)
Ensure sthat the two phrases are no longer synonyms of each other. The operation is symmetric, so they do not need to be removed in the reverse order.

Parameters:
phrase1 - First phrase in the synonym pair.
phrase2 - Second phrase in the synonym pair.

clearSynonyms

public void clearSynonyms()
Removes all synonym pairs from this synonym matcher.