stansent icon indicating copy to clipboard operation
stansent copied to clipboard

stansent::check_setup() confirms Java and coreNLP installed but sentiment_stanford() returns error

Open leungi opened this issue 7 years ago • 3 comments

library(stansent)
  check_setup()
#> 
#> checking if Java is installed...
#> 
#> checking if Java is installed...

#> java version "1.8.0_171"
#> Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
#> Java HotSpot(TM) Client VM (build 25.171-b11, mixed mode, sharing)

#> checking minimal Java version...

#> Java appears to be installed and at least of the minimal version.

#> checking if coreNLP is installed...

#> Stanford coreNLP appears to be installed.

#> ...Let the NLP tagging begin!
> mytext <- c(
   'do you like it?  But I hate really bad dogs',
   'I am the best friend.',
   'Do you really like it?  I\'m not a fan'
 )
> 
> out1 <- sentiment_stanford(mytext)
#> Warning message:
#> running command 'java -cp "P:/stanford-corenlp-full-2017-06-09/*" -mx5g edu.stanford.nlp.sentiment.SentimentPipeline 
#> -stdin' had status 1 

I tried installing stanford-corenlp-full-2017-06-09 in the R library stansent folder, but to no avail.

Look forward to your advise.

Thanks!

leungi avatar May 20 '18 19:05 leungi

Can you show sessionInfo()?

trinker avatar May 20 '18 20:05 trinker

Thanks for the prompt response @trinker!

sessionInfo()
#> R version 3.4.3 (2017-11-30)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 7 x64 (build 7601) Service Pack 1
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.1252 
#> [2] LC_CTYPE=English_United States.1252   
#> [3] LC_MONETARY=English_United States.1252
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.1252    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] compiler_3.4.3  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2
#>  [5] tools_3.4.3     htmltools_0.3.6 yaml_2.1.19     Rcpp_0.12.16   
#>  [9] stringi_1.1.7   rmarkdown_1.9   knitr_1.20      stringr_1.3.0  
#> [13] digest_0.6.15   evaluate_0.10.1

Created on 2018-05-20 by the reprex package (v0.2.0).

leungi avatar May 20 '18 20:05 leungi

Hello,

I am experiencing the same error.

Error
mytext <- c(
    'do you like it?  But I hate really bad dogs',
    'I am the best friend.',
    'Do you really like it?  I\'m not a fan'
)

mytext <- get_sentences(mytext)
sentiment_stanford(mytext)

   element_id sentence_id word_count sentiment
1:          1           1         11         0
2:          2           1          5         0
3:          3           1         10         0

Warning message:
In system(cmd, input = text.var, intern = TRUE, ignore.stderr = TRUE) :
  running command 'java -cp "C:/stanford-corenlp-full-2017-06-09/*" -mx5g edu.stanford.nlp.sentiment.SentimentPipeline -stdin' had status 1
Session Info
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

Random number generation:
 RNG:     Mersenne-Twister 
 Normal:  Inversion 
 Sample:  Rounding 
 
locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dplyr_1.0.2        sentimentr_2.7.1   stansent_0.2.0     coreNLPsetup_0.0.1 pacman_0.5.1      

loaded via a namespace (and not attached):
 [1] rstudioapi_0.11   magrittr_1.5      tidyselect_1.1.0  textclean_0.9.3   R6_2.4.1          rlang_0.4.7      
 [7] fansi_0.4.1       tools_4.0.2       data.table_1.13.0 lexicon_1.2.1     xfun_0.15         tinytex_0.24     
[13] cli_2.0.2         ellipsis_0.3.1    assertthat_0.2.1  textshape_1.7.1   tibble_3.0.3      lifecycle_0.2.0  
[19] crayon_1.3.4      purrr_0.3.4       vctrs_0.3.2       syuzhet_1.0.4     glue_1.4.1        qdapRegex_0.7.2  
[25] stringi_1.4.6     compiler_4.0.2    pillar_1.4.6      generics_0.0.2    pkgconfig_2.0.3  

Any assistance would be extremely helpful!

Thank you.

ResearchLabDev avatar Aug 26 '20 20:08 ResearchLabDev