【问题标题】:Lemmatization corpus in RR中的词形还原语料库
【发布时间】:2020-04-17 12:25:26
【问题描述】:

我发现有一个包可用于实现词形还原“textstem”。 但我无法安装它。 我正在共享用于安装的脚本和我得到的错误。

> install.packages("textstem")
Installing package into ‘C:/Users/nilesh.ulhas.hulyal/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘textstem’ is not available (for R version 3.2.5)
> if (!require("pacman")) install.packages("pacman")
> pacman::p_load_gh("trinker/textstem")
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Peer certificate cannot be authenticated with given CA certificates
Warning message:
In pacman::p_load_gh("trinker/textstem") : 
Failed to install/load:
trinker/textstem
> library(textstem)
Error in library(textstem) : there is no package called ‘textstem’
> docs1 <- tm_map(docs1, lemmatize_strings())
Error in match.fun(FUN) : could not find function "lemmatize_strings"

我在尝试使用 tm 包中的 Lemmatizationfunction 时分享以下代码和错误

> docs1 <- tm_map(docs1, lemmatize_strings)
Error in match.fun(FUN) : object 'lemmatize_strings' not found

还有其他方法可以用来在 R 中实现词形还原语料库吗?

【问题讨论】:

  • 完美运行:install.packages("textstem") library(textstem) x &lt;- c("culturing", "cultured", "cultures") lemmatize_strings(x, dictionary = lexicon::hash_lemmas)
  • @ChrisRuehlemann,我试过的 textstem 包,但它不支持 R 版本 3.2.5 。有没有其他方法来安装它。我也尝试从 .zip 或 tar.gz 文件安装它。但它没有安装
  • 我会去 github project page 获取 textstem 并发布一个问题,看看作者是否在某个地方有一个旧版本可以与你的旧版本 R 一起使用。我也会问这个问题,如果当前包可能在 3.2.5 中工作,或者如果有特定原因需要 3.3。您可能可以对代码进行一些小的修改以使其与 3.2.5 一起使用,或者它可能按原样工作(除非安装检查),只是没有针对该版本进行测试。

标签: r nlp lemmatization


【解决方案1】:

textstem 库对此负责,但您似乎必须将其附加到代码中,而不是调用该库。

要使“lemmatize_string”函数起作用,它必须像这样完成:

docs1 <- tm_map(docs1, textstem::lemmatize_strings)

【讨论】:

    猜你喜欢
    • 2019-08-01
    • 2014-07-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-27
    • 1970-01-01
    相关资源
    最近更新 更多