[R] Error in Parts of Speach Tagging using openNLP

David Winsemius dwinsemius at comcast.net
Wed Sep 4 02:38:59 CEST 2013


This was also posted on StackOverflow. Crossposting to R-help is discouraged. You are encouraged to read the Posting Guide and to learn how to post from gmail using plain text.

-- 
David.


On Sep 3, 2013, at 10:15 AM, Siddharth Arun wrote:

> I have an Ubuntu Quantal 12.10 Server 64-bit instance. I am using openNLP
> for POS Tagging of sentences.
> 
> I am using POS tagging using openNLP with „Parallel Lapply setup‰. It is
> running fine in RStudio environment. But in Ubuntu environment it is
> showing the following error.
> 
> 
> 
> *Error in do.call(c, clusterApply(cl, x = splitList(X, length(cl)), fun =
> lapply,  :*
> 
> *  second argument must be a list*
> 
> 
> Any suggestion for the problem I‚m facing?
> 
> 
> 
> This is the code that I am using:
> 
> 
> 
> 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()
> 
>  })
> 
> 
> 
> This is the setup I am using:
> 
> · Created an cloud instance with "Ubuntu Quantal 12.10 Server 64-bit
> instance"
> 
> 
> 
> · Installed LAMP server in the instance
> 
> 
> 
> · After which I installed R. By default R version was 2.15.0
> 
> 
> 
> · Upgraded the R version to R 3.0.1
> 
> -- 
> Regards,
> 
> Siddharth Arun,
> Contact No. - +91 8880065278
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list