opennlp.tools.coref.resolver
Class ResolverUtils

java.lang.Object
  extended by opennlp.tools.coref.resolver.ResolverUtils

public class ResolverUtils
extends Object

This class provides a set of utilities for turning mentions into normalized strings and features.


Field Summary
static Pattern designatorsPattern
          Regular expression for English corporate designators.
static Pattern femalePronounPattern
          Regular expression for English female pronouns.
static Pattern firstPersonPronounPattern
          Regular expression for English first person pronouns.
static Pattern honorificsPattern
          Regular expression for English honorifics.
static Pattern malePronounPattern
          Regular expression for English male pronouns.
static Pattern neuterPronounPattern
          Regular expression for English neuter pronouns.
static Pattern pluralPronounPattern
          Regular expression for English plural pronouns.
static Pattern pluralThirdPersonPronounPattern
          Regular expression for English plural third person pronouns.
static Pattern secondPersonPronounPattern
          Regular expression for English singular second person pronouns.
static Pattern singularPronounPattern
          Regular expression for English singular pronouns.
static Pattern singularThirdPersonPronounPattern
          Regular expression for English singular third person pronouns.
static Pattern speechPronounPattern
          Regular expression for English speech pronouns.
static Pattern thirdPersonPronounPattern
          Regular expression for English third person pronouns.
 
Constructor Summary
ResolverUtils()
           
 
Method Summary
static Set<String> constructModifierSet(Parse[] tokens, int headIndex)
           
static boolean definiteArticle(String tok, String tag)
          Returns whether the specified token is a definite article.
static String excludedDeterminerMentionString(MentionContext ec)
           
static String excludedHonorificMentionString(MentionContext ec)
           
static String excludedTheMentionString(MentionContext ec)
           
static List<String> getCompatibilityFeatures(MentionContext mention, DiscourseEntity entity, TestSimilarityModel simModel)
          Returns features indicating whether the specified mention and the specified entity are compatible.
static List<String> getContextFeatures(MentionContext mention)
          Returns a list of features based on the surrounding context of the specified mention.
static List<String> getDistanceFeatures(MentionContext mention, DiscourseEntity entity)
          Returns distance features for the specified mention and entity.
static String getExactMatchFeature(MentionContext ec, MentionContext xec)
           
static String getGenderCompatibilityFeature(MentionContext ec, DiscourseEntity de)
           
static String getMentionCountFeature(DiscourseEntity de)
           
static String getNumberCompatibilityFeature(MentionContext ec, DiscourseEntity de)
           
static String getPronounGender(String pronoun)
          Returns a string representing the gender of the specified pronoun.
static List<String> getPronounMatchFeatures(MentionContext mention, DiscourseEntity entity)
          Returns features indicating whether the specified mention is compatible with the pronouns of the specified entity.
static MentionContext getProperNounExtent(DiscourseEntity de)
           
static String getSemanticCompatibilityFeature(MentionContext ec, DiscourseEntity de, TestSimilarityModel simModel)
           
static List<String> getStringMatchFeatures(MentionContext mention, DiscourseEntity entity)
          Returns string-match features for the the specified mention and entity.
static List<String> getWordFeatures(Parse token)
          Returns a list of word features for the specified tokens.
static boolean isSubstring(String ecStrip, String xecStrip)
           
static String mentionString(MentionContext ec)
           
static String stripNp(MentionContext mention)
          Returns a string for the specified mention with punctuation, honorifics, designators, and determiners removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singularThirdPersonPronounPattern

public static final Pattern singularThirdPersonPronounPattern
Regular expression for English singular third person pronouns.


pluralThirdPersonPronounPattern

public static final Pattern pluralThirdPersonPronounPattern
Regular expression for English plural third person pronouns.


speechPronounPattern

public static final Pattern speechPronounPattern
Regular expression for English speech pronouns.


femalePronounPattern

public static final Pattern femalePronounPattern
Regular expression for English female pronouns.


neuterPronounPattern

public static final Pattern neuterPronounPattern
Regular expression for English neuter pronouns.


firstPersonPronounPattern

public static final Pattern firstPersonPronounPattern
Regular expression for English first person pronouns.


secondPersonPronounPattern

public static final Pattern secondPersonPronounPattern
Regular expression for English singular second person pronouns.


thirdPersonPronounPattern

public static final Pattern thirdPersonPronounPattern
Regular expression for English third person pronouns.


singularPronounPattern

public static final Pattern singularPronounPattern
Regular expression for English singular pronouns.


pluralPronounPattern

public static final Pattern pluralPronounPattern
Regular expression for English plural pronouns.


malePronounPattern

public static final Pattern malePronounPattern
Regular expression for English male pronouns.


honorificsPattern

public static final Pattern honorificsPattern
Regular expression for English honorifics.


designatorsPattern

public static final Pattern designatorsPattern
Regular expression for English corporate designators.

Constructor Detail

ResolverUtils

public ResolverUtils()
Method Detail

getContextFeatures

public static List<String> getContextFeatures(MentionContext mention)
Returns a list of features based on the surrounding context of the specified mention.

Parameters:
mention - he mention whose surround context the features model.
Returns:
a list of features based on the surrounding context of the specified mention

getWordFeatures

public static List<String> getWordFeatures(Parse token)
Returns a list of word features for the specified tokens.

Parameters:
token - The token for which features are to be computed.
Returns:
a list of word features for the specified tokens.

constructModifierSet

public static Set<String> constructModifierSet(Parse[] tokens,
                                               int headIndex)

excludedDeterminerMentionString

public static String excludedDeterminerMentionString(MentionContext ec)

excludedHonorificMentionString

public static String excludedHonorificMentionString(MentionContext ec)

excludedTheMentionString

public static String excludedTheMentionString(MentionContext ec)

getExactMatchFeature

public static String getExactMatchFeature(MentionContext ec,
                                          MentionContext xec)

getStringMatchFeatures

public static List<String> getStringMatchFeatures(MentionContext mention,
                                                  DiscourseEntity entity)
Returns string-match features for the the specified mention and entity.

Parameters:
mention - The mention.
entity - The entity.
Returns:
list of string-match features for the the specified mention and entity.

isSubstring

public static boolean isSubstring(String ecStrip,
                                  String xecStrip)

mentionString

public static String mentionString(MentionContext ec)

stripNp

public static String stripNp(MentionContext mention)
Returns a string for the specified mention with punctuation, honorifics, designators, and determiners removed.

Parameters:
mention - The mention to be striped.
Returns:
a normalized string representation of the specified mention.

getProperNounExtent

public static MentionContext getProperNounExtent(DiscourseEntity de)

getPronounMatchFeatures

public static List<String> getPronounMatchFeatures(MentionContext mention,
                                                   DiscourseEntity entity)
Returns features indicating whether the specified mention is compatible with the pronouns of the specified entity.

Parameters:
mention - The mention.
entity - The entity.
Returns:
list of features indicating whether the specified mention is compatible with the pronouns of the specified entity.

getDistanceFeatures

public static List<String> getDistanceFeatures(MentionContext mention,
                                               DiscourseEntity entity)
Returns distance features for the specified mention and entity.

Parameters:
mention - The mention.
entity - The entity.
Returns:
list of distance features for the specified mention and entity.

definiteArticle

public static boolean definiteArticle(String tok,
                                      String tag)
Returns whether the specified token is a definite article.

Parameters:
tok - The token.
tag - The pos-tag for the specified token.
Returns:
whether the specified token is a definite article.

getNumberCompatibilityFeature

public static String getNumberCompatibilityFeature(MentionContext ec,
                                                   DiscourseEntity de)

getCompatibilityFeatures

public static List<String> getCompatibilityFeatures(MentionContext mention,
                                                    DiscourseEntity entity,
                                                    TestSimilarityModel simModel)
Returns features indicating whether the specified mention and the specified entity are compatible.

Parameters:
mention - The mention.
entity - The entity.
Returns:
list of features indicating whether the specified mention and the specified entity are compatible.

getGenderCompatibilityFeature

public static String getGenderCompatibilityFeature(MentionContext ec,
                                                   DiscourseEntity de)

getSemanticCompatibilityFeature

public static String getSemanticCompatibilityFeature(MentionContext ec,
                                                     DiscourseEntity de,
                                                     TestSimilarityModel simModel)

getMentionCountFeature

public static String getMentionCountFeature(DiscourseEntity de)

getPronounGender

public static String getPronounGender(String pronoun)
Returns a string representing the gender of the specified pronoun.

Parameters:
pronoun - An English pronoun.
Returns:
the gender of the specified pronoun.


Copyright © 2010. All Rights Reserved.