gov.llnl.ontology.wordnet
Class SynsetRelations

java.lang.Object
  extended by gov.llnl.ontology.wordnet.SynsetRelations

public class SynsetRelations
extends Object

This represents a collection of methods that determine the relationship between two Synsets. These relations include existence of a parent relationship between two Synsets, existence of a cousin relationship between two Synests, and methods for finding lowest common parents of two Synsets.

Author:
Keith Stevens

Nested Class Summary
static class SynsetRelations.HypernymStatus
          The possible hypernym statuses.
 
Constructor Summary
SynsetRelations()
           
 
Method Summary
static edu.ucla.sspace.util.Duple<Synset,Double> bestAttachmentPoint(OntologyReader wordnet, String[] attachmentLocations, double[] attachmentScores, Map<String,Double> cousinScores, double lambda)
          Returns the Synset, the liklihood of this being the best parent, which is the best attachment point based on the set of possible hypernym lemmas.
static edu.ucla.sspace.util.Duple<Synset,Double> bestAttachmentPointWithError(OntologyReader wordnet, String[] attachmentLocations, double[] attachmentScores, double lambda)
           
static edu.ucla.sspace.util.Pair<Integer> getCousinDistance(Synset[] term1Synsets, Synset[] term2Synsets, int maxDepth)
          Returns a Pair of Integers that specifies the the minimum distances from a Synset and term1 a Synset of term2 to lowest common parent Synset which creates the shorest path between the two synsets.
static SynsetRelations.HypernymStatus getHypernymStatus(Synset[] childSynsets, Synset[] ancestorSynsets)
          Returns the hypernym relationship between some Synset of childTerm and some Synset of ancestorTerm.
static int longestPathDistance(Synset synset1, Synset synset2)
          Returns the length of the longest path connecting synset1 and synset2.
static Synset lowestCommonHypernym(Synset synset1, Synset synset2)
          Returns the deepest Synset that subsumes both synset1 and synset2.
static List<Synset> lowestCommonHypernyms(Synset synset1, Synset synset2)
          Returns the set of deepest Synsets that subsumes both synset1 and synset2.
static Map<Synset,Integer> parentDistances(Synset synset, boolean findMax)
          Returns a mapping from a Synset to it's maximum (or minimum) distance to the given Synset.
static int shortestPathDistance(Synset synset1, Synset synset2)
          Returns the length of the shortest path connecting synset1 and synset2.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynsetRelations

public SynsetRelations()
Method Detail

getHypernymStatus

public static SynsetRelations.HypernymStatus getHypernymStatus(Synset[] childSynsets,
                                                               Synset[] ancestorSynsets)
Returns the hypernym relationship between some Synset of childTerm and some Synset of ancestorTerm. If neither term is found in wordnet, SynsetRelations.HypernymStatus.TERMS_MISSING is returned. If childTerm has a mapping but ancestorTerm is missing from wordnet, SynsetRelations.HypernymStatus.NOVEL_HYPERNYM is returned. If vice-versa, HyernymStatus#NOVEL_HYPONYM. If both terms have a mapping and some Synset of ancestorTerm acts as an ancestors of some Synset of childTerm, this returns SynsetRelations.HypernymStatus.KNOWN_HYPERNYM. If none of the above, this returns SynsetRelations.HypernymStatus.KNOWN_NON_HYPERNYM.

Parameters:
childTerm - A term which might have a Synset that is a child of a Synset of ancestorTerm
ancestorTerm - A term which might have a Synset that is a parent of a Synset of childTerm

lowestCommonHypernym

public static Synset lowestCommonHypernym(Synset synset1,
                                          Synset synset2)
Returns the deepest Synset that subsumes both synset1 and synset2.


lowestCommonHypernyms

public static List<Synset> lowestCommonHypernyms(Synset synset1,
                                                 Synset synset2)
Returns the set of deepest Synsets that subsumes both synset1 and synset2. Each returned Synset has the same depth.


shortestPathDistance

public static int shortestPathDistance(Synset synset1,
                                       Synset synset2)
Returns the length of the shortest path connecting synset1 and synset2.


longestPathDistance

public static int longestPathDistance(Synset synset1,
                                      Synset synset2)
Returns the length of the longest path connecting synset1 and synset2.


getCousinDistance

public static edu.ucla.sspace.util.Pair<Integer> getCousinDistance(Synset[] term1Synsets,
                                                                   Synset[] term2Synsets,
                                                                   int maxDepth)
Returns a Pair of Integers that specifies the the minimum distances from a Synset and term1 a Synset of term2 to lowest common parent Synset which creates the shorest path between the two synsets. This method will compute all possible Synset combinations of term1Synsets and term2Synsets to find this optimal distance. If either optimal distance is of length greater than maxDepth it will be repaced with Integer.MAX_VALUE.

This distance can be interpreted as the distance at which term1 and term2 can be considered cousins. For example, a cousin depth of "5-4" signifies that some Synset of term1 is 5 nodes away from a common hypernym and some Synset of term2 is 4 nodes away from the same common hypernym. This common hypernym is selected such that the total path, 5+4, is the shortest path connecting these two term Synsets.

Parameters:
term1Synsets - The Synsets of the first term consider in a cousin relationship
term2Synsets - The Synsets of the second term consider in a cousin relationship
maxDepth - The maximal depth for cousin relationships

parentDistances

public static Map<Synset,Integer> parentDistances(Synset synset,
                                                  boolean findMax)
Returns a mapping from a Synset to it's maximum (or minimum) distance to the given Synset.

Parameters:
synset - The synset from which paths should begin
findMax - If true, the mapping will contain the maximum distances, otherwise it will contain the minimum distances.

bestAttachmentPoint

public static edu.ucla.sspace.util.Duple<Synset,Double> bestAttachmentPoint(OntologyReader wordnet,
                                                                            String[] attachmentLocations,
                                                                            double[] attachmentScores,
                                                                            Map<String,Double> cousinScores,
                                                                            double lambda)
Returns the Synset, the liklihood of this being the best parent, which is the best attachment point based on the set of possible hypernym lemmas. If some new term needs to be added to WordNet, and one has probabilities that the new term is a hyponym of some terms or the cousin of other terms, this method selects the Synset corresponding to the known term that is most likely the hypernym.

Parameters:
attachmentLocations - The array of words related to the to be added term through either a potential hypernym relationship or cousin relationship
attachmentScores - The probability that each potentially related terms is a hypernym of the to be added term
cousinScores - A mapping for each potentially related terms of cousin depths to the probabilty of the related term being having that cousin relationship with the to be added term. Keys the maps must be of the form INT-INT, with the largest value being first.
lambda - A decay parameter. If a term in attachmentLocations is a potential hypernym, and other terms in attachmentLocations are hypernyms of this potential term, then this lambda value is used to modify the likelihood of the implied reliationships

bestAttachmentPointWithError

public static edu.ucla.sspace.util.Duple<Synset,Double> bestAttachmentPointWithError(OntologyReader wordnet,
                                                                                     String[] attachmentLocations,
                                                                                     double[] attachmentScores,
                                                                                     double lambda)


Copyright © 2010-2011. All Rights Reserved.