【发布时间】:2020-07-23 11:53:28
【问题描述】:
我在 ubuntu 18.4 上使用 R studio,特别是 cleannlp 包来根据 this tutorial found here https://statsmaths.github.io/cleanNLP/state-of-union.html 分析文本。
根据here - https://statsmaths.github.io/cleanNLP/ 的安装说明,到目前为止,我已经在 Rstudio 的控制台中安装了 cleannlp,就像 install.packages("cleanNLP") 一样。此外,我已经在终端中安装了它的模块pip install cleannlp。据我所知,这两种安装都没有遇到任何问题。
如安装说明所示,cleannlp 有 4 个后端:
cnlp_init_stringi(locale="en_GB")
cnlp_init_udpipe(model_name="english")
cnlp_init_spacy(model_name="en")
cnlp_init_corenlp(lang="en")
我使用 stringi 或 udpipe 似乎没有任何问题。但是,使用 spacy 和 corenlp 后端似乎会抛出这个错误
Error: Python module 'cleannlp' not found. Install with: pip install cleannlp
4. stop(msg, call. = (msg == ""))
3. assert(!is.null(disc$required_module_path), "Python module 'cleannlp' not found. Install with:\n pip install cleannlp")
2. check_python()
1. cnlp_init_spacy("/usr/local/lib/python3.6/")
我相当肯定 python 包安装成功,从以下推断:
(base) redapemusic35@mythinker:~$ pip install cleannlp
Processing ./.cache/pip/wheels/1e/23/e6/a201f9e10a6664d0639453ee4f19bba7baf8544e9e82b18d1b/cleannlp-1.0.3-py3- none-any.whl
Requirement already satisfied: spacy in ./anaconda3/lib/python3.7/site-packages (from cleannlp) (2.2.3)
Requirement already satisfied: plac<1.2.0,>=0.9.6 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (1.1.3)
Requirement already satisfied: setuptools in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (45.2.0.post20200210)
Requirement already satisfied: srsly<1.1.0,>=0.1.0 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (1.0.2)
Requirement already satisfied: blis<0.5.0,>=0.4.0 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (0.4.1)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (1.0.2)
Requirement already satisfied: numpy>=1.15.0 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (1.18.1)
Requirement already satisfied: thinc<7.4.0,>=7.3.0 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (7.3.1)
Requirement already satisfied: wasabi<1.1.0,>=0.4.0 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (0.6.0)
Requirement already satisfied: requests<3.0.0,>=2.13.0 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (2.22.0)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (3.0.2)
Requirement already satisfied: catalogue<1.1.0,>=0.0.7 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (1.0.0)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in ./anaconda3/lib/python3.7/site-packages (from spacy->cleannlp) (2.0.3)
Requirement already satisfied: tqdm<5.0.0,>=4.10.0 in ./anaconda3/lib/python3.7/site-packages (from thinc<7.4.0,>=7.3.0->spacy->cleannlp) (4.42.1)
Requirement already satisfied: idna<2.9,>=2.5 in ./anaconda3/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->cleannlp) (2.8)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./anaconda3/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->cleannlp) (1.25.8)
Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->cleannlp) (2019.11.28)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./anaconda3/lib/python3.7/site-packages (from requests<3.0.0,>=2.13.0->spacy->cleannlp)(3.0.4)
Requirement already satisfied: importlib-metadata>=0.20; python_version< "3.8" in ./anaconda3/lib/python3.7/site-packages (from catalogue<1.1.0,>=0.0.7->spacy->cleannlp) (1.5.0)
Requirement already satisfied: zipp>=0.5 in ./anaconda3/lib/python3.7/site-packages (from importlib-metadata>=0.20; python_version < "3.8"->catalogue<1.1.0,>=0.0.7->spacy->cleannlp) (2.2.0)
Installing collected packages: cleannlp
Successfully installed cleannlp-1.0.3
我尝试过的一些事情包括
- 没有路径
cnlp_init_spacy()
这给了我:
Error: Python module 'cleannlp' not found. Install with: pip install cleannlp
4. stop(msg, call. = (msg == ""))
3.
assert(!is.null(disc$required_module_path), "Python module 'cleannlp' not found. Install with:\n pip install cleannlp")
2. check_python()
1. cnlp_init_spacy()
无论我使用哪个后端(spacy 和 corenlp)都给我带来麻烦没有区别。
-
sudo pip install sudo -H pip install sudo -H pip3 install和sudo pip3 install所有这些似乎都工作正常。但是,我想知道 R 选择哪个安装是否有问题。所以我卸载并再次尝试。此外,我似乎对 R 之外的 python 有任何问题。
【问题讨论】: