1 Reply Latest reply on Oct 14, 2018 9:42 PM by Prabhu H

    Sentiment in Tableau with R( For few it is showing Blank)

    Prabhu H

      Hi,

       

      I used the Below script for the Sentiment in Tableau with R . I got the Output but the issue is few of the Text it is not showing (Blank) showing.

       

       

      Below is the Output

       

       

       

       

      SCRIPT_STR('library(syuzhet);

      len <- length(.arg1);

      result<-numeric(len);

      for (i in 1:len){

      token <- get_tokens(.arg1[i]);

      sentiment <- get_sentiment(token,method = "syuzhet")

      sentiment <- sentiment[sentiment!=0]

      result[i]<-mean(sentiment)

      }

      as.character(cut(result,breaks=c(-Inf, 0.3, 0.5, Inf),labels=c("negative","neutral","positive")))',

      ATTR([Comment Text]))

       

       

      Regards,

      Prabhu