Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

wet and moisture antonyms?

Help
2007-05-17
2013-04-29
  • John T Langton
    John T Langton
    2007-05-17

    I hacked up the Examples.java code (and its working) to find all relationships between "wet" and "moister". One of them lists them as antonyms.  Are certain PointerTypes being ignored, or does the pointertype note mean that it is the type of relationship between words?

    Here's the output (culled from many relationships) that says they're antonyms, unless I'm reading it wrong:

    [IndexWord: [Lemma: wet] [POS: noun]] and [IndexWord: [Lemma: moisture] [POS: noun]] are related in sense 1

    [PointerType: [Label: antonym] [Key: !] Applies To: noun, verb, adjective, adverb, lexical] relationship between "wet" and "moisture":
      [PointerTargetNode: [Synset: [Offset: 10424695] [POS: noun] Words: moisture, wet -- (wetness caused by water; "drops of wet gleamed on the window")] [PointerType: [Label: antonym] [Key: !] Applies To: noun, verb, adjective, adverb, lexical]]
    Depth: 0

    Any help or direction would be appreciated.

    Just for completeness, here are relevant code snippets:

    private void johnRelantionshipTest(IndexWord start, IndexWord end)
                throws JWNLException {

            // first just test for an immediate relationship
            int senseIndex = RelationshipFinder.getInstance()
                    .getImmediateRelationship(start, end);
            System.out.println(start + " and " + end + " are related in sense "
                    + senseIndex);

            // track down any relationship of any type at any depth
            boolean negativeMessage = true;
            RelationshipList list;
            for (int k = 0; k < PointerType.TYPES.length; k++) {
                list = RelationshipFinder.getInstance().findRelationships(
                        start.getSense(1), end.getSense(1), PointerType.TYPES[k]);
                if (list.size() > 0) {
                    printRelationships(list, start, end);
                    negativeMessage = false;
                }
            }
            if (negativeMessage) {
                System.out.println("no relationships of any kind found\n\n");
            }
        }

        public void printRelationships(RelationshipList list, IndexWord start,
                IndexWord end) {
            // I'm not sure this is accurate for every relationthip type, but for a
            // hypernym relationship then these indexes will be the parent index and
            // depth of the tree
            if (list.size() <= 0) {
                return;
            }

            for (Iterator itr = list.iterator(); itr.hasNext();) {
                Relationship relationship = (Relationship) itr.next();
                System.out.println(relationship.getType()
                        + " relationship between \&quot;" + start.getLemma()
                        + "\&quot; and \&quot;" + end.getLemma() + "\&quot;:");
                relationship.getNodeList().print();
                // a symmetrical relationship means there is no common parent
                // because the words are synonyms
                // an asymmetrical relationship means you have to go up the tree of
                // meanings until you find a common parent
                if (relationship instanceof AsymmetricRelationship) {
                    // this will only work with assymetric relationships
                    System.out.println("Common Parent Index: "
                            + ((AsymmetricRelationship) relationship)
                                    .getCommonParentIndex());
                }
                System.out.println("Depth: "
                        + ((Relationship) list.get(0)).getDepth());
                System.out
                        .println("------------------------------------------------------------------");
            }
        }

    thanks,
    John