I'm trying to implement a sentiment analysis study on data extracted from Twitter, with R. I am using the udpipe library when I write
udpipe_dowload_model("model")
model< <- udpipe_load_model("directory)
out <- as.data.frame(udpipe_annotate(object, x, doc_id,...)
and I run, an exception is raised:
Error in udp_tokenise_tag_parse(object$model, x, doc_id, tokenizer, tagger, :
external pointer is not valid
the relative traceback is:
4.
stop(structure(list(message = "external pointer is not valid",
call = udp_tokenise_tag_parse(object$model, x, doc_id, tokenizer,
tagger, parser, log_every, log_now), cppstack = structure(list(
file = "", line = -1L, stack = c("1 udpipe.so 0x0000000117ba907e _ZN4Rcpp9exceptionC2EPKcb + 222", ...
3.
udp_tokenise_tag_parse(object$model, x, doc_id, tokenizer, tagger,
parser, log_every, log_now)
2.
udpipe_annotate(model, x = x, doc_id = doc_id, trace = F) at textAnalysisFunct.R#221
1.
lemmaUDP(x = twt$text_clean, model = modelI, doc_id = twt$doc_id,
stopw = tm::stopwords("italian"), userstopw = mystop)
then I started to debug and on the console appeared:
Error during wrapup: external pointer is not valid
the function lemmaUDP was created by my teacher, if useful I paste here its definition as well, but is the same as if done manually
lemmaUDP <- function(x = NULL,
model = NULL,
doc_id = NULL,
stopw = tm::stopwords("italian"),
userstopw=NULL){
require(udpipe)
if(is.null(x)){message("manca vettore testi");return()}
if(is.null(model)){message("manca modello");return()}
if(class(x) != "character"){message("il vettore x non รจ di tipo testo");return()}
if(class(model) != "udpipe_model"){message("modello non valido");return()}
if(is.null(doc_id)){doc_id <- 1:length(x)}
if(!is.null(userstopw)){
stopw <- c(stopw,userstopw)
}
xx <- udpipe_annotate(model, x = x, doc_id = doc_id,trace = F)
xx <- as.data.frame(xx)
xx$STOP <- ifelse(xx$lemma %in% stopw | xx$token %in% stopw,TRUE,FALSE)
return(xx)
}