无法在R中加载wordnet包

无法在R中加载wordnet包

问题描述:

我在加载wordnet到R时遇到了问题。我使用R x64 2.14.1。我安装了软件包wordnet,然后尝试加载软件包。无法在R中加载wordnet包

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

什么是错?如何以及如何设置WNHOME目录。

数据必须单独安装。 如果你在Linux上,只需安装“wordnet”包(在Windows上,它会更加手动)。

sudo apt-get install wordnet # For Debian-based distributions 

您需要设置字典路径。见下面的例子。

setDict("/Users/kasper2304/Desktop/WordNet-3.0/dict") 

此外我有问题使用R-studio,所以我不得不使用JGR。

我有这个问题,通过下载和安装http://wordnetcode.princeton.edu/2.1/WordNet-2.1.exe共发现 ,然后重新运行

library(wordnet) 
setDict("C:/Program Files (x86)/WordNet/2.1/dict") 

这工作得很好解决了这个问题。我们需要WNHOME设置是./WordNet/2.1来自R使用Sys.setenv()字典的父目录

library(wordnet) 
setDict("C:/Program Files (x86)/WordNet/2.1/dict") 
Sys.setenv(WNHOME = "C:/Program Files (x86)/WordNet/2.1") 

我面临同样的问题,同时呼吁在R“共发现”在Windows上的库。 然后经过多次不成功的试用,我从此网站下载了WordNet_2.1.exe文件https://en.freedownloadmanager.org/users-choice/Wordnet_2.1.html。 下载完成后,您可以直接在R中设置路径并继续不再进行中断。对我来说这工作:

library(wordnet) 
    setDict("C:/Program Files/WordNet/2.1/dict") 
    Sys.setenv(WNHOME = "C:/Program Files/WordNet/2.1") 
    getDict() 

试试吧!