R(NLP包)中的方法注释是否已被弃用或替换?

问题描述 投票:1回答:2

我正在关注这篇文章https://mylearnmachinelearning.com/category/linear-regression/来创建一个命名实体提取器。如需要,我安装了所有openNLPNLPrJavamagrittropenNLPmodels.en包。除了使用这个功能annotations时,所有人都去了计划。

 # Extract entities from an AnnotatedPlainTextDocument
     entities <- function(doc, kind) {
     s <- doc$content
     a <- annotations(doc)[[1]] #Point of error
     if(hasArg(kind)) {
         k <- sapply(a$features, `[[`, "kind")
         s[a[k == kind]]
     } else {
         s[a[a$type == "entity"]]
     }
 }

通过使用这个:

entities(text_doc, kind = "person")

事情是甚至RStudio中的intellisense似乎不知道任何功能annotations。它显示annotationannotateannotations_in_spans什么不是,但没有annotations

甚至有一个YouTube video也证明了这一点。奇怪的是他能够在那里使用annotations

包装版本:

  1. openNLP:v0.2-6
  2. openNLPmodels.en:v1.5-1
  3. rJava - v0.9-9
  4. magrittr - v1.5
  5. NLP - v0.2-0
r opennlp rjava magrittr
2个回答
2
投票

在早期版本的annotations包中,AnnotatedPlainTextDocument方法与NLP类型的对象相关联。

Here is the documentation版本0.1-11。

The latest NLP version是0.2-0。

The method for AnnotatedPlainTextDocument现在被称为annotation(最后没有'')。从文档中看,它的主要区别在于它返回一个Annotation对象,而不是Annotation对象列表。


1
投票

功能annotations有很多包,请看这里:https://www.rdocumentation.org/search?q=annotations

虽然可能不是最好的方法,但如果您在不知道该功能属于哪个软件包的情况下寻找特定功能,该网站可能会帮助您找到这样的软件包。

© www.soinside.com 2019 - 2024. All rights reserved.