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

Close

JWNL Wordnet 3.0 configuration and setup

2011-09-30
2014-11-17
  • kyle wagner
    kyle wagner
    2011-09-30

    Just downloaded WordNet 3.0 and JWNL. Running on a mac os x 10.6, eclipse 3.6.2. I couldn't get this thing to work - kept getting the errors below.

    The two things I did that fixed it (beyond setting dictionary_path correctly):
    1. file_properties.xml needs to have this line changed from "1.7" to "3.0"

    <version publisher="Princeton" number="3.0" language="en"/>

    2.  WordNet/dict contains a bunch of files. Apparently, the ones called "index.xxx" need to be renamed to "xxx.exc".
    So, index.noun => noun.exc
    etc.

    Hopefully that'll help someone else from having the same frustrations I went through getting this thing to work!

    (error message below for reference)

    net.didion.jwnl.JWNLException: Unable to install net.didion.jwnl.dictionary.FileBackedDictionary
    at net.didion.jwnl.util.factory.Element.install(Element.java:34)
    at net.didion.jwnl.JWNL.initialize(JWNL.java:169)
    at nlp.experiments.WordNetTest.testJWNL(WordNetTest.java:106)
    at nlp.experiments.WordNetTest.main(WordNetTest.java:17)
    Caused by: net.didion.jwnl.JWNLException: The properties file must specify a dictionary path
    at net.didion.jwnl.util.factory.AbstractValueParam.create(AbstractValueParam.java:34)
    at net.didion.jwnl.dictionary.FileBackedDictionary.install(FileBackedDictionary.java:111)
    at net.didion.jwnl.util.factory.Element.install(Element.java:32)
    … 3 more
    Caused by: net.didion.jwnl.JWNLException: Could not create a file manager of type class net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile
    at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.create(FileManagerImpl.java:98)
    at net.didion.jwnl.util.factory.AbstractValueParam.create(AbstractValueParam.java:32)
    … 5 more
    Caused by: java.io.FileNotFoundException: /Users/me/Documents/eclipse/workspace/MachineLearning/resources/WordNet/dict/adv.exc (No such file or directory)
    at java.io.RandomAccessFile.open(Native Method)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:216)
    at net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile.openFile(PrincetonRandomAccessDictionaryFile.java:76)
    at net.didion.jwnl.dictionary.file.AbstractDictionaryFile.open(AbstractDictionaryFile.java:58)
    at net.didion.jwnl.dictionary.file.DictionaryCatalog.open(DictionaryCatalog.java:45)
    at net.didion.jwnl.dictionary.file.DictionaryCatalogSet.open(DictionaryCatalogSet.java:34)
    at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.<init>(FileManagerImpl.java:71)
    at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.create(FileManagerImpl.java:96)
    … 6 more

     
    • Harry Delugach
      Harry Delugach
      2014-11-17

      Thanks! This fix is still needed as of Wordnet 3.1 with JWNL 1.4

       
  • Seonho Kim
    Seonho Kim
    2012-02-04

    Thank you very much. Your solution really saved me. I was almost give up the fxxing jwnl.

     
  • Abreal
    Abreal
    2012-02-21

    I'm facing the same problem.
    where can I find the file_properties.
    need help
    thanks

     
  • Prakashkumar
    Prakashkumar
    2013-01-29

    hello ..any one can help me…
    i'm doing a project based on  semantic similarity between  documents. so i want decide to use this jwnl package  in my application. i need to check the sample code… but it's not working….
    i thing the error happening for initialize()…in fileinputstream…..please help me

    public class usage {

    // private static final String USAGE1 = "java Examples <properties file>";
    public static void main(String args) throws IOException, FileNotFoundException ,JWNLException{
    IndexWord wordnet;
    try
    {
    System.out.println("hello13");
    String prop="C:\\jwnl\\jwnl14-rc2\\jwnl14-rc2\\config\\file_properties.xml";
            // FileInputStream fis = new FileInputStream("file_properties.xml");
             JWNL.initialize(new FileInputStream(prop));
    //initialize();

    wordnet = Dictionary.getInstance().getIndexWord(POS.VERB, "run");
    Synset sense = wordnet.getSense(1);
        System.out.println(sense);
    PointerTargetNodeList relatedList = PointerUtils.getInstance().getSynonyms(sense);
    Iterator i = relatedList.iterator();
      while (i.hasNext()) {
       PointerTargetNode related = (PointerTargetNode) i.next();
      Synset s = related.getSynset();
      System.out.println(s);

      }
       //System.out.println("hello3");

    }
    catch (Exception ex) {

    }
    }

    }