在最新版本的R中使用wordnet获取同义词

在最新版本的R中使用wordnet获取同义词,r,R,我尝试在最新版本的R中使用wordnet包查找同义词 我下载了wordnet文件,下面是错误的以下操作: > 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/WordNe

我尝试在最新版本的R中使用wordnet包查找同义词

我下载了wordnet文件,下面是错误的以下操作:

> 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")
R中的wordnet软件包是否存在一般问题

这似乎适合我(使用Sys.setenv(WNHOME…而不使用initDict()):

库(wordnet)
Sys.setenv(WNHOME=“C://WordNet-3.0/dict”)
setDict(“C://WordNet-3.0/dict”)
同义词(“汽车”、“名词”)
[1] “自动”“汽车”“缆车”“轿厢”“电梯轿厢”“平底船”
[7] “机器”“汽车”“有轨电车”“有轨电车”“有轨电车”

可能重复@Fernando谢谢你的评论。我的问题中有答案的一些步骤,我也尝试了你提供的链接中答案的步骤,但还是有错误。你能成功运行wordnet吗?
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
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"