could not find Wordnet dictionary error

流过昼夜 提交于 2019-12-12 10:03:23

问题


I'm having trouble running wordnet in R. I loaded it into the library initially, but it didn't work. The error looked like this:

Warning message:
In initDict() :
  cannot find WordNet 'dict' directory: please set the environment variable WNHOME to its parent

So, I added this line: Sys.setenv(WNHOME = "C:\\Program Files (x86)\\WordNet\\2.1") and then was able to use the library function to load it. I don't understand this line or error message at all, but it seems to fix this problem.

However, whenever I try to use the package, it won't work. For example, I entered:

filter <- getTermFilter("ExactMatchFilter", "hot", TRUE)
terms <- getIndexTerms("ADJECTIVE", 1, filter)

and got the following error message after the second line:

Error in getDict() : could not find Wordnet dictionary

I don't understand what this means. Do I have to set a dictionary? How would I do this, and to what should I set it? Otherwise, how do I get rid of this error message?

Thanks everyone for your time!


回答1:


The R wordnet package is designed for Wordnet 3.0, and you seem to be using 2.1, so I imagine that would be the problem.

As a second guess, try installing Wordnet in a path with no spaces in it. E.g. c:\\data\\wordnet

By the way, instead of using Sys.setenv() to set an environment variable, it appears you could instead do setDict("C:\\Program Files (x86)\\WordNet\\3.0") before the call to initDict(), or even simply give that path as the optional parameter to initDict().



来源:https://stackoverflow.com/questions/24331985/could-not-find-wordnet-dictionary-error

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