Reputation: 375
I try to find synonyms using wordnet package in the latest version of R.
I have downloaded the wordnet file and here are the following action with the errors:
> library(wordnet)
Warning message:
In initDict() :
cannot find WordNet 'dict' directory: please set the environment variable WNHOME to its parent
> initDict("C:/Users/iris/Downloads/WordNet-3.0/WordNet-3.0/dict")
[1] TRUE
> library(wordnet)
> Str = synonyms("help")
Error in charmatch(x, WN_synset_types) :
argument "pos" is missing, with no default
> synonyms("company", "NOUN")
Error in getDict() : could not find Wordnet dictionary
> getDict("C:/Users/iris/Downloads/WordNet-3.0/WordNet-3.0/dict")
Error in getDict("C:/Users/iris/Downloads/WordNet-3.0/WordNet-3.0/dict") :
unused argument ("C:/Users/iris/Downloads/WordNet-3.0/WordNet-3.0/dict")
Is there any general problem with wordnet package in R?
or
library(wordnet)
Warning message:
In initDict() :
cannot find WordNet 'dict' directory: please set the environment variable WNHOME to its parent
> initDict()
[1] FALSE
Warning message:
In initDict() :
cannot find WordNet 'dict' directory: please set the environment variable WNHOME to its parent
> setDict("C:/Users/iris/Downloads/WordNet-3.0/WordNet-3.0/dict")
> getDict()
[1] "Java-Object{com.nexagis.jawbone.Dictionary@1540e19d}"
> initDict()
[1] FALSE
Warning message:
In initDict() :
cannot find WordNet 'dict' directory: please set the environment variable WNHOME to its parent
Upvotes: 1
Views: 767
Reputation: 21
This seems to work for me (with Sys.setenv(WNHOME... and without initDict()):
library(wordnet)
Sys.setenv(WNHOME ="C:/<windows path>/WordNet-3.0/dict")
setDict("C:/<windows path>/WordNet-3.0/dict")
synonyms("car","NOUN")
[1] "auto" "automobile" "cable car" "car" "elevator car" "gondola"
[7] "machine" "motorcar" "railcar" "railroad car" "railway car"
Upvotes: 1