Runtime error in using wordnet through JWNL, error in the props file

不打扰是莪最后的温柔 提交于 2019-12-25 06:46:05

问题


hey i've tried this in netbeans but it won't work it gives me the same error no matter what i do! can anyone help?


JWNL.initialize(new FileInputStream("C:\\Users\\Desktop\\file_properties.xml"));

wordnet = Dictionary.getInstance();
IndexWord word = wordnet.getIndexWord(POS.VERB,"run");
Synset[] senses = word.getSenses();
for (int i = 0; i < senses.length; i++) 
{
   System.out.println(word + ": " + senses[i].getGloss());
}

and getting missing file exception :

Exception in thread "main" 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 testss.Testss.main(Testss.java:43)
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)
    ... 2 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)
    ... 4 more
Caused by: java.io.FileNotFoundException: C:\Program Files\WordNet\2.1\dict\index.adv (The system cannot find the file specified)
    at java.io.RandomAccessFile.open(Native Method)
    at java.io.RandomAccessFile.<init>(RandomAccessFile.java:241)
    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)
    ... 5 more

回答1:


Update Wordnet db version being used in jwnlProperties.xml

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

File names in db have changed over versions, and JWNL supports them.

This should solve your problem, discussed in other places as well. http://sourceforge.net/p/jwordnet/discussion/106153/thread/5ccfc039/



来源:https://stackoverflow.com/questions/20839275/runtime-error-in-using-wordnet-through-jwnl-error-in-the-props-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!