根据Rita Homepage,您只需要下载Rita.jar和
WordNet-3.1并将两者都添加到您的Java项目的构建路径中。

我是那样做的,每次尝试使用它时:

RiWordNet wordNet = new RiWordNet(Test.class.getResource("/WordNet-3.1").getPath());


我得到:

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at rita.wordnet.jwnl.util.factory.Element.install(Unknown Source)
at rita.wordnet.jwnl.JWNL.initialize(Unknown Source)
at rita.RiWordNet.initWordNet(Unknown Source)
at rita.RiWordNet.<init>(Unknown Source)
at rita.RiWordNet.<init>(Unknown Source)
at de.hof.iisys.relationExtraction.analyzer.utils.Rita.main(Rita.java:13)
Caused by: rita.wordnet.jwnl.JWNLException: The properties file must specify a dictionary path
at rita.wordnet.jwnl.util.factory.AbstractValueParam.create(Unknown Source)
at rita.wordnet.jwnl.dictionary.FileBackedDictionary.installStatic(Unknown Source)
... 10 more
Caused by: rita.wordnet.RiWordNetError:
 [ERROR] Couldn't find file: .\WordNet-3.1\dict\index.verb
at rita.wordnet.WordnetDictionaryFile.openFile(Unknown Source)
at rita.wordnet.jwnl.dictionary.file.AbstractDictionaryFile.open(Unknown Source)
at rita.wordnet.jwnl.dictionary.file.DictionaryCatalog.open(Unknown Source)
at rita.wordnet.jwnl.dictionary.file.DictionaryCatalogSet.open(Unknown Source)
at rita.wordnet.jwnl.dictionary.file_manager.FileManagerImpl.<init>(Unknown Source)
at rita.wordnet.jwnl.dictionary.file_manager.FileManagerImpl.create(Unknown Source)
at rita.wordnet.jwnl.util.factory.AbstractValueParam.create(Unknown Source)
... 11 more

最佳答案

数据文件不再作为安装的一部分提供。您需要下载平台的WordNet版本,然后将其传递给构造函数,如here所述。

10-08 06:31