Sid*_*rth 5 cloud command-line r pos-tagger opennlp
我有一个Ubuntu Quantal 12.10服务器64位实例.我正在使用openNLP进行句子的POS标记.
我正在使用带有"Parallel Lapply setup"的openNLP进行POS标记.它在RStudio环境中运行良好.但在Ubuntu环境中,它显示以下错误.
Error in do.call(c, clusterApply(cl, x = splitList(X, length(cl)), fun = lapply, :
second argument must be a list
Run Code Online (Sandbox Code Playgroud)
对我面临的问题有任何建议吗?
这是我正在使用的代码:
tagPOS <- function(x, ...) {
s <- as.String(x)
word_token_annotator <- Maxent_Word_Token_Annotator()
a2 <- Annotation(1L, "sentence", 1L, nchar(s))
a2 <- annotate(s, word_token_annotator, a2)
a3 <- annotate(s, PTA, a2)
a3w <- a3[a3$type == "word"]
POStags <- unlist(lapply(a3w$features, `[[`, "POS"))
POStagged <- paste(sprintf("%s/%s", s[a3w], POStags), collapse = " ")
list(POStagged = POStagged, POStags = POStags)
}
cl <- makeCluster(mc <- getOption("cl.cores", detectCores()/2))
clusterEvalQ(cl, {
library(openNLP)
library(NLP)
PTA <- Maxent_POS_Tag_Annotator()
})
Run Code Online (Sandbox Code Playgroud)
这是我正在使用的设置:
使用"Ubuntu Quantal 12.10 Server 64位实例"创建云实例
在实例中安装了LAMP服务器
之后我安装了R.默认情况下,R版本是2.15.0
将R版本升级到R 3.0.1
| 归档时间: |
|
| 查看次数: |
1340 次 |
| 最近记录: |