Class RelationshipFinder


  • public class RelationshipFinder
    extends java.lang.Object
    • Constructor Detail

      • RelationshipFinder

        private RelationshipFinder()
    • Method Detail

      • getImmediateRelationship

        public int getImmediateRelationship​(IndexWord sourceWord,
                                            IndexWord targetWord)
                                     throws JWNLException
        Looks at whether the target word is one of the words in one of the synsets of the source word.
        Returns:
        int the sense of the source word that contains the target word
        Throws:
        JWNLException
      • findRelationships

        public RelationshipList findRelationships​(Synset sourceSynset,
                                                  Synset targetSynset,
                                                  PointerType type)
                                           throws JWNLException
        Find all relationships of type type between sourceSynset and targetSynset. This method creates a symmetric or asymmetric relationship based on whether type is symmetric.
        Throws:
        JWNLException
      • findRelationships

        public RelationshipList findRelationships​(Synset sourceSynset,
                                                  Synset targetSynset,
                                                  PointerType type,
                                                  int depth)
                                           throws JWNLException
        Find all relationships of type type between sourceSynset and targetSynset to depth depth. This method creates a symmetric or asymmetric relationship based on whether type is symmetric.
        Throws:
        JWNLException
      • findAsymmetricRelationships

        private RelationshipList findAsymmetricRelationships​(Synset sourceSynset,
                                                             Synset targetSynset,
                                                             PointerType type)
                                                      throws JWNLException
        Finds the asymmetric relationship(s) between two words. A relationship is asymmetric if its type is asymmetric (i.e. it's not its own inverse).
        Throws:
        JWNLException
      • findAsymmetricRelationships

        private RelationshipList findAsymmetricRelationships​(Synset sourceSynset,
                                                             Synset targetSynset,
                                                             PointerType type,
                                                             int depth)
                                                      throws JWNLException
        Finds the asymmetric relationship(s) between two words. A relationship is asymmetric if its type is asymmetric (i.e. it's not its own inverse).
        Throws:
        JWNLException
      • findAsymmetricRelationship

        private Relationship findAsymmetricRelationship​(PointerTargetNodeList sourceNodes,
                                                        PointerTargetNodeList targetNodes,
                                                        PointerType type,
                                                        Synset sourceSynset,
                                                        Synset targetSynset)
        Find a relationship between two asymmetric lists ordered from deepest to shallowest ancestor. Each node has it's PointerType set to the kind of relationship one need to follow to get from it to the next node in the list. Take the dog/cat relationship. To get to carnivore, a hypernym relationship must be used to get from dog to carnivore, but then a hyponym relationship must be used to get from carnivore to cat. The list will look like this: dog(hyper) -> canine(hyper) -> carnivore(hypo) -> feline(hypo) -> cat(hypo). In this instance, cat's PointerType is meaningless, but is kept to facilitate things like reversing the relationship (which just involves setting each node's pointer type to the symmetric type of its current type.
      • findSymmetricRelationships

        private RelationshipList findSymmetricRelationships​(Synset sourceSynset,
                                                            Synset targetSynset,
                                                            PointerType type)
                                                     throws JWNLException
        A symmetric relationship is one whose type is symmetric (i.e. is it's own inverse. An example of a symmetric relationship is synonomy.
        Throws:
        JWNLException