WN: How to get rid of example dogs and cats ?

Help
2004-02-15
2004-02-18
  • Dear all,

    I am in the process of testing the WordNet Java api for my purposes.
    From the examples.java I've derived a small .java in order to learn how I can use it (code further down).
    The word to query in my example is 'ecg'.

    I did also ajust the file_properties.xml to reflect the
    path to my WordNet dictionary.

    When I compile and start this simple Java I get the
    same dogs & cats output from the example rather than something on 'ecg' !!??

    I call it with %JAVA_HOME\bin\java net.didion.jwnl.utilities.wnacc file_properties.xml

    Am I missing something important here ??

    Any help is greatly appreciated.

    Kind regards,

    Holger

    *******************************

    Dr Holger Adelmann
    Loughborough, UK

    here comes the code:

    /**
    * Java WordNet Library (JWNL)
    * See the documentation for copyright information.
    *
    * @version 1.1
    */
    package net.didion.jwnl.utilities;

    import net.didion.jwnl.JWNL;
    import net.didion.jwnl.JWNLException;
    import net.didion.jwnl.data.IndexWord;
    import net.didion.jwnl.data.POS;
    import net.didion.jwnl.data.PointerType;
    import net.didion.jwnl.data.PointerUtils;
    import net.didion.jwnl.data.list.PointerTargetNodeList;
    import net.didion.jwnl.data.list.PointerTargetTree;
    import
    net.didion.jwnl.data.relationship.AsymmetricRelationship;
    import net.didion.jwnl.data.relationship.Relationship;
    import
    net.didion.jwnl.data.relationship.RelationshipFinder;
    import
    net.didion.jwnl.data.relationship.RelationshipList;
    import net.didion.jwnl.dictionary.Dictionary;

    import java.io.FileInputStream;
    import java.util.Iterator;

    /** A class to demonstrate the functionality of the
    JWNL package. */
    public class wnacc {
        private static final String USAGE = "java Examples
    <properties file>";

        public static void main(String[] args) {
            if (args.length != 1) {
                System.out.println(USAGE);
                System.exit(-1);
            }

            String propsFile = args[0];
            try {
                // initialize JWNL (this must be done before JWNL
    can be used)
                JWNL.initialize(new FileInputStream(propsFile));
                new Examples().go();
            } catch (Exception ex) {
                ex.printStackTrace();
                System.exit(-1);
            }
        }
       
        private IndexWord QUERY;
       
            public wnacc() throws JWNLException {
            QUERY =
    Dictionary.getInstance().getIndexWord(POS.VERB, "ecg");
        }   
       
            public void go() throws JWNLException {
            ListOperation(QUERY);
        }
       
            private void ListOperation(IndexWord word) throws
    JWNLException {
            // Get all of the hypernyms (parents) of the first
    sense of <var>word</var>
            PointerTargetNodeList hypernyms =
    PointerUtils.getInstance().getDirectHypernyms(word.getSense(1));
            System.out.println("Direct hypernyms of \&quot;" +
    word.getLemma() + "\&quot;:");
            hypernyms.print();
        }
       
    }

     
    • Dear all,

      sorry for that post - sometimes one gets process blind. Found the error. Still used 'Examples' with go()

      -Holger