在 R 中加载 wordnet 包时出现问题

发布于 2024-12-27 05:28:25 字数 290 浏览 4 评论 0原文

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

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

怎么了?我应该如何设置 WNHOME 目录以及设置什么内容。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

完美的未来在梦里 2025-01-03 05:28:25

您需要设置字典路径。请参见下面的示例。

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

此外,我在使用 R-studio 时遇到了问题,所以我被迫使用 JGR。

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.

零崎曲识 2025-01-03 05:28:25

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

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

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
っ〆星空下的拥抱 2025-01-03 05:28:25

这很好用。我们需要使用 Sys.setenv() 将 WNHOME 设置为 dict 的父目录,即 R 中的 ./WordNet/2.1

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

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") 
万水千山粽是情ミ 2025-01-03 05:28:25

我遇到了这个问题,并通过从 http://wordnetcode.princeton 下载并安装 wordnet 解决了它。 edu/2.1/WordNet-2.1.exe
然后重新运行

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

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")
猫烠⑼条掵仅有一顆心 2025-01-03 05:28:25

我在 Windows 上的 R 中调用库“wordnet”时遇到了同样的问题。
然后经过多次不成功的尝试,我从这个网站下载了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()

尝试一下!

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!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文