|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.llnl.ontology.wordnet.SynsetRelations
public class SynsetRelations
This represents a collection of methods that determine the relationship
between two Synset
s. These relations include existence of a parent
relationship between two Synset
s, existence of a cousin relationship
between two Synest
s, and methods for finding lowest common parents of
two Synset
s.
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 Integer s 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 Synset s 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 |
---|
public SynsetRelations()
Method Detail |
---|
public static SynsetRelations.HypernymStatus getHypernymStatus(Synset[] childSynsets, Synset[] ancestorSynsets)
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
.
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
public static Synset lowestCommonHypernym(Synset synset1, Synset synset2)
Synset
that subsumes both synset1
and
synset2
.
public static List<Synset> lowestCommonHypernyms(Synset synset1, Synset synset2)
Synset
s that subsumes both synset1
and synset2
. Each returned Synset
has the same
depth.
public static int shortestPathDistance(Synset synset1, Synset synset2)
synset1
and
synset2
.
public static int longestPathDistance(Synset synset1, Synset synset2)
synset1
and
synset2
.
public static edu.ucla.sspace.util.Pair<Integer> getCousinDistance(Synset[] term1Synsets, Synset[] term2Synsets, int maxDepth)
Pair
of Integer
s 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 Synset
s.
term1Synsets
- The Synset
s of the first term consider in a
cousin relationshipterm2Synsets
- The Synset
s of the second term consider in a
cousin relationshipmaxDepth
- The maximal depth for cousin relationshipspublic static Map<Synset,Integer> parentDistances(Synset synset, boolean findMax)
Synset
to it's maximum (or minimum)
distance to the given Synset
.
synset
- The synset from which paths should beginfindMax
- If true, the mapping will contain the maximum distances,
otherwise it will contain the minimum distances.public static edu.ucla.sspace.util.Duple<Synset,Double> bestAttachmentPoint(OntologyReader wordnet, String[] attachmentLocations, double[] attachmentScores, Map<String,Double> cousinScores, double lambda)
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.
attachmentLocations
- The array of words related to the to be added
term through either a potential hypernym relationship or cousin
relationshipattachmentScores
- The probability that each potentially related
terms is a hypernym of the to be added termcousinScores
- 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 reliationshipspublic static edu.ucla.sspace.util.Duple<Synset,Double> bestAttachmentPointWithError(OntologyReader wordnet, String[] attachmentLocations, double[] attachmentScores, double lambda)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |