opennlp.tools.coref.resolver
Class ResolverUtils

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

public class ResolverUtils
extends java.lang.Object

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


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

Field Detail

singularThirdPersonPronounPattern

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


pluralThirdPersonPronounPattern

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


speechPronounPattern

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


femalePronounPattern

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


neuterPronounPattern

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


firstPersonPronounPattern

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


secondPersonPronounPattern

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


thirdPersonPronounPattern

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


singularPronounPattern

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


pluralPronounPattern

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


malePronounPattern

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


honorificsPattern

public static final java.util.regex.Pattern honorificsPattern
Regular expression for English honorifics.


designatorsPattern

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

Constructor Detail

ResolverUtils

public ResolverUtils()
Method Detail

getContextFeatures

public static java.util.List<java.lang.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 java.util.List<java.lang.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 java.util.Set<java.lang.String> constructModifierSet(Parse[] tokens,
                                                                   int headIndex)

excludedDeterminerMentionString

public static java.lang.String excludedDeterminerMentionString(MentionContext ec)

excludedHonorificMentionString

public static java.lang.String excludedHonorificMentionString(MentionContext ec)

excludedTheMentionString

public static java.lang.String excludedTheMentionString(MentionContext ec)

getExactMatchFeature

public static java.lang.String getExactMatchFeature(MentionContext ec,
                                                    MentionContext xec)

getStringMatchFeatures

public static java.util.List<java.lang.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(java.lang.String ecStrip,
                                  java.lang.String xecStrip)

mentionString

public static java.lang.String mentionString(MentionContext ec)

stripNp

public static java.lang.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 java.util.List<java.lang.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 java.util.List<java.lang.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(java.lang.String tok,
                                      java.lang.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 java.lang.String getNumberCompatibilityFeature(MentionContext ec,
                                                             DiscourseEntity de)

getCompatibilityFeatures

public static java.util.List<java.lang.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 java.lang.String getGenderCompatibilityFeature(MentionContext ec,
                                                             DiscourseEntity de)

getSemanticCompatibilityFeature

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

getMentionCountFeature

public static java.lang.String getMentionCountFeature(DiscourseEntity de)

getPronounGender

public static java.lang.String getPronounGender(java.lang.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 © 2011 The Apache Software Foundation. All Rights Reserved.