Reputation: 16395
I have trouble loading wordnet into R. I use R x64 2.14.1. I installed the package wordnet and then I tried to load the package.
> library(wordnet)
Warning message:
In initDict() :
cannot find WordNet 'dict' directory: please set the environment variable WNHOME to its parent
What is wrong? How and to what should I set the directory WNHOME.
Upvotes: 8
Views: 7265
Reputation: 1
I was facing the same problem while calling the library "wordnet" in R on Windows. Then after many unsuccessful trials,I downloaded the WordNet_2.1.exe file from this site https://en.freedownloadmanager.org/users-choice/Wordnet_2.1.html. After downloading this,you can directly set path in R and proceed with no further interuptions. For me this worked:
library(wordnet)
setDict("C:/Program Files/WordNet/2.1/dict")
Sys.setenv(WNHOME = "C:/Program Files/WordNet/2.1")
getDict()
Try it!!
Upvotes: 0
Reputation: 31
This works fine. We need to set WNHOME to dict's parent directory which is ./WordNet/2.1 from R using Sys.setenv()
library(wordnet)
setDict("C:/Program Files (x86)/WordNet/2.1/dict")
Sys.setenv(WNHOME = "C:/Program Files (x86)/WordNet/2.1")
Upvotes: 2
Reputation: 915
You need to set the dictionary path. See example below.
setDict("/Users/kasper2304/Desktop/WordNet-3.0/dict")
Further I had problems using R-studio so I was forced to use JGR.
Upvotes: 7
Reputation: 11
I had this problem and solved it by downloading and installing wordnet from http://wordnetcode.princeton.edu/2.1/WordNet-2.1.exe and then rerunning
library(wordnet)
setDict("C:/Program Files (x86)/WordNet/2.1/dict")
Upvotes: 1
Reputation: 32381
The data has to be installed separately. If you are on Linux, just install the "wordnet" package (on Windows, it will be more manual).
sudo apt-get install wordnet # For Debian-based distributions
Upvotes: 4