我有一个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 …Run Code Online (Sandbox Code Playgroud)