Package net.didion.jwnl.data
Class PointerUtils
java.lang.Object
net.didion.jwnl.data.PointerUtils
This class constains static methods for performing various pointer operations. A pointer from one synset/word to
another connotes a relationship between those words. The type of the relationship is specified by the type
of pointer. See the WordNet documentation for information on pointer types. To avoid confusion with
the
Relationship
class, these relationships will be referred to as links.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Representation of infinite depth.private static final PointerUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAlsoSees
(Synset synset) Find what words are related tosynset
getAlsoSeeTree
(Synset synset, int depth) Find all See Also relations to depthdepth
.getAntonyms
(Synset synset) Get the words that mean the opposite ofsynset
getAttributes
(Synset synset) Get the attributes ofsynset
Find direct cause links ofsynset
getCauseTree
(Synset synset) Find all cause links forsynset
.getCauseTree
(Synset synset, int depth) Find all cause links forsynset
to depthdepth
.getCoordinateTerms
(Synset synset) Getsynset
's siblings (the hyponyms of its hypernyms)getDerived
(Synset synset) Find derrived links ofsynset
getDirectHypernyms
(Synset synset) Get the immediate parents ofsynset
getDirectHyponyms
(Synset synset) Get the immediate children ofsynset
getEntailedBy
(Synset synset) Find direct entailed bys ofsynset
getEntailedByTree
(Synset synset) Find all entailed bys ofsynset
.getEntailedByTree
(Synset synset, int depth) Find all entailed bys ofsynset
to depthdepth
.getEntailments
(Synset synset) Find direct entailments ofsynset
getEntailmentTree
(Synset synset) Find all entailments forsynset
getEntailmentTree
(Synset synset, int depth) Find all entailments forsynset
to depthdepth
getExtendedAntonyms
(Synset synset) Get the words that mean the opposite ofsynset
and the immediate synonyms of those wordsgetExtendedAntonyms
(Synset synset, int depth) Find all antonyms ofsynset
, and all synonyms of those antonyms to depthdepth
.getHolonyms
(Synset synset) Get holonyms ofsynset
getHypernymTree
(Synset synset) Get all of the ancestors ofsynset
getHypernymTree
(Synset synset, int depth) Get all of the ancestors ofsynset
to depthdepth
getHyponymTree
(Synset synset) Get all of the children ofsynset
getHyponymTree
(Synset synset, int depth) Get all of the children ofsynset
to depthdepth
getIndirectAntonyms
(Synset synset) Get the immediate antonyms of all words that mean the same assynset
.getIndirectAntonyms
(Synset synset, int depth) Get the antonyms of all words that mean the same assynset
to depthdepth
.getInheritedHolonyms
(Synset synset) Get holonyms ofsynset
and of all its ancestorsgetInheritedHolonyms
(Synset synset, int pointerDepth, int ancestorDepth) Get holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.getInheritedMemberHolonyms
(Synset synset) Get member holonyms ofsynset
and of all its ancestorsgetInheritedMemberHolonyms
(Synset synset, int pointerDepth, int ancestorDepth) Get member holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.getInheritedMemberMeronyms
(Synset synset) Get member meronyms of synset and of its ancestorsgetInheritedMemberMeronyms
(Synset synset, int pointerDepth, int ancestorDepth) Get member meronyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.getInheritedMeronyms
(Synset synset, int pointerDepth, int ancestorDepth) Get meronyms of each synset, to depthpointerDepth
starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.getInheritedPartHolonyms
(Synset synset) Get part holonyms ofsynset
and of all its ancestorsgetInheritedPartHolonyms
(Synset synset, int pointerDepth, int ancestorDepth) Get part holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.getInheritedPartMeronyms
(Synset synset) Get part meronyms ofsynset
and of all its ancestorsgetInheritedPartMeronyms
(Synset synset, int pointerDepth, int ancestorDepth) Get part meronyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.getInheritedSubstanceHolonyms
(Synset synset) Get substance holonyms ofsynset
and of all its ancestorsgetInheritedSubstanceHolonyms
(Synset synset, int pointerDepth, int ancestorDepth) Get substance holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.getInheritedSubstanceMeronyms
(Synset synset) Get substance meronyms ofsynset
and of its ancestorsgetInheritedSubstanceMeronyms
(Synset synset, int pointerDepth, int ancestorDepth) Get substance meronyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.static PointerUtils
getInteritedMeronyms
(Synset synset) Get meronyms ofsynset
and of all its ancestorsgetMemberHolonyms
(Synset synset) Get member holonyms ofsynset
getMemberMeronyms
(Synset synset) Get member meronyms ofsynset
getMeronyms
(Synset synset) Get meronyms ofsynset
.getPartHolonyms
(Synset synset) Get part holonyms ofsynset
getParticipleOf
(Synset synset) Find participle of links ofsynset
getPartMeronyms
(Synset synset) Get part meronyms ofsynset
private PointerTargetNodeList
getPointerTargets
(Synset synset, PointerType type) Get all the pointer targets of synset of type type.getSubstanceHolonyms
(Synset synset) Get substance holonyms ofsynset
getSubstanceMeronyms
(Synset synset) Get substance meronyms ofsynset
getSynonyms
(Synset synset) Get the synonyms forsynset
.getSynonymTree
(Synset synset, int depth) Get all the synonyms ofsynset
to depthdepth
.getVerbGroup
(Synset synset) Get the group that this verb belongs to.makeInheritedTree
(PointerTargetTree tree, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) Turn an existing tree into an inheritance tree.makeInheritedTree
(Synset synset, PointerType searchType) Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of type searchType, starting at the node's pointer target.makeInheritedTree
(Synset synset, PointerType[] searchTypes) Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of the types specified in searchTypes, starting at the node's pointer target.makeInheritedTree
(Synset synset, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth) Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of the types specified in searchTypes, starting at the node's pointer target.makeInheritedTree
(Synset synset, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of the types specified in searchTypes, starting at the node's pointer target.makeInheritedTree
(Synset synset, PointerType searchType, PointerType labelType, int pointerDepth, int ancestorDepth) Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of type searchType, starting at the node's pointer target.makeInheritedTree
(Synset synset, PointerType searchType, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of type searchType, starting at the node's pointer target.makeInheritedTreeList
(PointerTargetTreeNodeList list, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) Turn an existing tree list into an inheritance tree list.makePointerTargetTreeList
(PointerTargetNodeList list, PointerType[] searchTypes, PointerType labelType, int depth, boolean allowRedundancies) Make a nested list of pointer targets to depth depth, starting at eachsynset
in list.makePointerTargetTreeList
(PointerTargetNodeList list, PointerType searchType, PointerType labelType, int depth, boolean allowRedundancies) Make a nested list of pointer targets to depth depth, starting at eachsynset
in list.makePointerTargetTreeList
(Synset set, PointerType searchType) Make a nested list of pointer targets to the default depth, starting atsynset
.makePointerTargetTreeList
(Synset set, PointerType[] searchTypes) Make a nested list of pointer targets to the default depth, starting atsynset
.makePointerTargetTreeList
(Synset set, PointerType[] searchTypes, int depth) Make a nested list of pointer targets to depth depth, starting atsynset
.makePointerTargetTreeList
(Synset synset, PointerType[] searchTypes, PointerType labelType, int depth, boolean allowRedundancies) Make a nested list of pointer targets to depth depth, starting atsynset
.private PointerTargetTreeNodeList
makePointerTargetTreeList
(Synset synset, PointerType[] searchTypes, PointerType labelType, int depth, boolean allowRedundancies, PointerTargetTreeNode parent) makePointerTargetTreeList
(Synset set, PointerType searchType, int depth) Make a nested list of pointer targets to depth depth, starting atsynset
.makePointerTargetTreeList
(Synset set, PointerType searchType, PointerType labelType, int depth, boolean allowRedundancies) Make a nested list of pointer targets to depth depth, starting atsynset
.
-
Field Details
-
INFINITY
public static final int INFINITYRepresentation of infinite depth. Used to tell the pointer operations to return all links to an infinite depth.- See Also:
-
INSTANCE
-
-
Constructor Details
-
PointerUtils
private PointerUtils()
-
-
Method Details
-
getInstance
-
getDirectHypernyms
Get the immediate parents ofsynset
- Throws:
JWNLException
-
getHypernymTree
Get all of the ancestors ofsynset
- Throws:
JWNLException
-
getHypernymTree
Get all of the ancestors ofsynset
to depthdepth
- Throws:
JWNLException
-
getDirectHyponyms
Get the immediate children ofsynset
- Throws:
JWNLException
-
getHyponymTree
Get all of the children ofsynset
- Throws:
JWNLException
-
getHyponymTree
Get all of the children ofsynset
to depthdepth
- Throws:
JWNLException
-
getCoordinateTerms
Getsynset
's siblings (the hyponyms of its hypernyms)- Throws:
JWNLException
-
getAntonyms
Get the words that mean the opposite ofsynset
- Throws:
JWNLException
-
getExtendedAntonyms
Get the words that mean the opposite ofsynset
and the immediate synonyms of those words- Throws:
JWNLException
-
getExtendedAntonyms
Find all antonyms ofsynset
, and all synonyms of those antonyms to depthdepth
.- Throws:
JWNLException
-
getIndirectAntonyms
Get the immediate antonyms of all words that mean the same assynset
.- Throws:
JWNLException
-
getIndirectAntonyms
Get the antonyms of all words that mean the same assynset
to depthdepth
.- Throws:
JWNLException
-
getAttributes
Get the attributes ofsynset
- Throws:
JWNLException
-
getAlsoSees
Find what words are related tosynset
- Throws:
JWNLException
-
getAlsoSeeTree
Find all See Also relations to depthdepth
.- Throws:
JWNLException
-
getMeronyms
Get meronyms ofsynset
.- Throws:
JWNLException
-
getPartMeronyms
Get part meronyms ofsynset
- Throws:
JWNLException
-
getMemberMeronyms
Get member meronyms ofsynset
- Throws:
JWNLException
-
getSubstanceMeronyms
Get substance meronyms ofsynset
- Throws:
JWNLException
-
getInteritedMeronyms
Get meronyms ofsynset
and of all its ancestors- Throws:
JWNLException
-
getInheritedMeronyms
public PointerTargetTree getInheritedMeronyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get meronyms of each synset, to depthpointerDepth
starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getInheritedPartMeronyms
Get part meronyms ofsynset
and of all its ancestors- Throws:
JWNLException
-
getInheritedPartMeronyms
public PointerTargetTree getInheritedPartMeronyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get part meronyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getInheritedMemberMeronyms
Get member meronyms of synset and of its ancestors- Throws:
JWNLException
-
getInheritedMemberMeronyms
public PointerTargetTree getInheritedMemberMeronyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get member meronyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getInheritedSubstanceMeronyms
Get substance meronyms ofsynset
and of its ancestors- Throws:
JWNLException
-
getInheritedSubstanceMeronyms
public PointerTargetTree getInheritedSubstanceMeronyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get substance meronyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getHolonyms
Get holonyms ofsynset
- Throws:
JWNLException
-
getPartHolonyms
Get part holonyms ofsynset
- Throws:
JWNLException
-
getMemberHolonyms
Get member holonyms ofsynset
- Throws:
JWNLException
-
getSubstanceHolonyms
Get substance holonyms ofsynset
- Throws:
JWNLException
-
getInheritedHolonyms
Get holonyms ofsynset
and of all its ancestors- Throws:
JWNLException
-
getInheritedHolonyms
public PointerTargetTree getInheritedHolonyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getInheritedPartHolonyms
Get part holonyms ofsynset
and of all its ancestors- Throws:
JWNLException
-
getInheritedPartHolonyms
public PointerTargetTree getInheritedPartHolonyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get part holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getInheritedMemberHolonyms
Get member holonyms ofsynset
and of all its ancestors- Throws:
JWNLException
-
getInheritedMemberHolonyms
public PointerTargetTree getInheritedMemberHolonyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get member holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getInheritedSubstanceHolonyms
Get substance holonyms ofsynset
and of all its ancestors- Throws:
JWNLException
-
getInheritedSubstanceHolonyms
public PointerTargetTree getInheritedSubstanceHolonyms(Synset synset, int pointerDepth, int ancestorDepth) throws JWNLException Get substance holonyms of each synset, to depthpointerDepth
, starting atsynset
and going for all ofsynset
's ancestors to depthancestorDepth
.- Throws:
JWNLException
-
getEntailments
Find direct entailments ofsynset
- Throws:
JWNLException
-
getEntailmentTree
Find all entailments forsynset
- Throws:
JWNLException
-
getEntailmentTree
Find all entailments forsynset
to depthdepth
- Throws:
JWNLException
-
getEntailedBy
Find direct entailed bys ofsynset
- Throws:
JWNLException
-
getEntailedByTree
Find all entailed bys ofsynset
.- Throws:
JWNLException
-
getEntailedByTree
Find all entailed bys ofsynset
to depthdepth
.- Throws:
JWNLException
-
getCauses
Find direct cause links ofsynset
- Throws:
JWNLException
-
getCauseTree
Find all cause links forsynset
.- Throws:
JWNLException
-
getCauseTree
Find all cause links forsynset
to depthdepth
.- Throws:
JWNLException
-
getVerbGroup
Get the group that this verb belongs to.- Throws:
JWNLException
-
getParticipleOf
Find participle of links ofsynset
- Throws:
JWNLException
-
getDerived
Find derrived links ofsynset
- Throws:
JWNLException
-
getSynonyms
Get the synonyms forsynset
. This is meant for adjectives. Synonyms to nouns and verbs are just their hypernyms.- Throws:
JWNLException
-
getSynonymTree
Get all the synonyms ofsynset
to depthdepth
.- Throws:
JWNLException
-
getPointerTargets
private PointerTargetNodeList getPointerTargets(Synset synset, PointerType type) throws JWNLException Get all the pointer targets of synset of type type.- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(Synset set, PointerType searchType) throws JWNLException Make a nested list of pointer targets to the default depth, starting atsynset
. Each level of the list is related to the previous level by a pointer of type searchType.- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(Synset set, PointerType searchType, int depth) throws JWNLException Make a nested list of pointer targets to depth depth, starting atsynset
. Each level of the list is related to the previous level by a pointer of type searchType.- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(Synset set, PointerType searchType, PointerType labelType, int depth, boolean allowRedundancies) throws JWNLException Make a nested list of pointer targets to depth depth, starting atsynset
. Each level of the list is related to the previous level by a pointer of type searchType.- Parameters:
labelType
- the type used to label each pointer target in the treeallowRedundancies
- if true, duplicate items will be included in the tree- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(Synset set, PointerType[] searchTypes) throws JWNLException Make a nested list of pointer targets to the default depth, starting atsynset
. Each level of the list is related to the previous level by one of the pointer types specified by searchTypes.- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(Synset set, PointerType[] searchTypes, int depth) throws JWNLException Make a nested list of pointer targets to depth depth, starting atsynset
. Each level of the list is related to the previous level by one of the pointer types specified by searchTypes.- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(Synset synset, PointerType[] searchTypes, PointerType labelType, int depth, boolean allowRedundancies) throws JWNLException Make a nested list of pointer targets to depth depth, starting atsynset
. Each level of the list is related to the previous level by one of the pointer types specified by searchTypes.- Parameters:
labelType
- the type used to label each pointer target in the treeallowRedundancies
- if true, duplicate items will be included in the tree- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(PointerTargetNodeList list, PointerType searchType, PointerType labelType, int depth, boolean allowRedundancies) throws JWNLException Make a nested list of pointer targets to depth depth, starting at eachsynset
in list. Each level of the list is related to the previous level by a pointer of type searchType.- Parameters:
labelType
- the type used to label each pointer target in the treeallowRedundancies
- if true, duplicate items will be included in the tree- Throws:
JWNLException
-
makePointerTargetTreeList
public PointerTargetTreeNodeList makePointerTargetTreeList(PointerTargetNodeList list, PointerType[] searchTypes, PointerType labelType, int depth, boolean allowRedundancies) throws JWNLException Make a nested list of pointer targets to depth depth, starting at eachsynset
in list. Each level of the list is related to the previous level by one of the pointer types specified by searchTypes.- Parameters:
labelType
- the type used to label each pointer target in the treeallowRedundancies
- if true, duplicate items will be included in the tree- Throws:
JWNLException
-
makePointerTargetTreeList
private PointerTargetTreeNodeList makePointerTargetTreeList(Synset synset, PointerType[] searchTypes, PointerType labelType, int depth, boolean allowRedundancies, PointerTargetTreeNode parent) throws JWNLException - Throws:
JWNLException
-
makeInheritedTree
public PointerTargetTree makeInheritedTree(Synset synset, PointerType searchType) throws JWNLException Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of type searchType, starting at the node's pointer target. This method uses the default depths.- Throws:
JWNLException
-
makeInheritedTree
public PointerTargetTree makeInheritedTree(Synset synset, PointerType searchType, PointerType labelType, int pointerDepth, int ancestorDepth) throws JWNLException Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of type searchType, starting at the node's pointer target.- Parameters:
pointerDepth
- the depth to which to search for each pointer listancestorDepth
- the depth to which to go to in the hypernym list- Throws:
JWNLException
-
makeInheritedTree
public PointerTargetTree makeInheritedTree(Synset synset, PointerType searchType, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) throws JWNLException Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of type searchType, starting at the node's pointer target.- Parameters:
pointerDepth
- the depth to which to search for each pointer listancestorDepth
- the depth to which to go to in the hypernym listallowRedundancies
- if true, duplicate items are allowed in the list- Throws:
JWNLException
-
makeInheritedTree
public PointerTargetTree makeInheritedTree(Synset synset, PointerType[] searchTypes) throws JWNLException Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of the types specified in searchTypes, starting at the node's pointer target. This method uses the default depths.- Throws:
JWNLException
-
makeInheritedTree
public PointerTargetTree makeInheritedTree(Synset synset, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth) throws JWNLException Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of the types specified in searchTypes, starting at the node's pointer target.- Parameters:
pointerDepth
- the depth to which to search for each pointer listancestorDepth
- the depth to which to go to in the hypernym list- Throws:
JWNLException
-
makeInheritedTree
public PointerTargetTree makeInheritedTree(Synset synset, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) throws JWNLException Create a hypernym tree starting at synset, and add to each node a nested list pointer targets of the types specified in searchTypes, starting at the node's pointer target.- Parameters:
pointerDepth
- the depth to which to search for each pointer listancestorDepth
- the depth to which to go to in the hypernym listallowRedundancies
- if true, duplicate items are allowed in the list- Throws:
JWNLException
-
makeInheritedTree
public PointerTargetTree makeInheritedTree(PointerTargetTree tree, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) throws JWNLException Turn an existing tree into an inheritance tree.- Parameters:
tree
- the tree to convertsearchTypes
- the pointer types to include in the pointer listslabelType
- thePointerType
with which to label each pointerpointerDepth
- the depth to which to search for each pointer listancestorDepth
- the depth to which to go to intree
allowRedundancies
- if true, duplicate items are allowed in the list- Throws:
JWNLException
-
makeInheritedTreeList
public PointerTargetTreeNodeList makeInheritedTreeList(PointerTargetTreeNodeList list, PointerType[] searchTypes, PointerType labelType, int pointerDepth, int ancestorDepth, boolean allowRedundancies) throws JWNLException Turn an existing tree list into an inheritance tree list.- Parameters:
list
- the tree list to convertsearchTypes
- the pointer types to include in the pointer listslabelType
- thePointerType
with which to label each pointerpointerDepth
- the depth to which to search for each pointer listancestorDepth
- the depth to which to go to intree
allowRedundancies
- if true, duplicate items are allowed in the list- Throws:
JWNLException
-