knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", message = FALSE, warning = FALSE, error = FALSE )
The goal of deepSentimentR is to provide functionality to query, view and analyze sentiment datasets.
install.packages("dplyr") install.packages("keras") keras::install_keras()
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("adityamangal410/deepSentimentR")
You can use rocker, which provides a set of docker images with R and different flavours of tidyverse, ML, geospatial etc.
docker run -d --name rstudio -p 8787:8787 -e PASSWORD=<PASSWORD> -e USER=<USER> -v /Users/<USER>/Desktop:/Desktop rocker/ml
Go to http://localhost:8787 to login to the rstudio server.
devtools::install_github("adityamangal410/deepSentimentR")
Experimental steps
docker run -d --name rstudio -p 8787:8787 -e PASSWORD=<PASSWORD> -e USER=<USER> -v /Users/<USER>/Desktop:/Desktop rocker/tidyverse
Go to http://localhost:8787 to login to the rstudio server.
library(tidyverse) system("python -V") # make sure you're using python3 #If Not, login to docker container and run following #rm /usr/bin/python #ln -s /usr/bin/python3 /usr/bin/python #apt-get install curl system("curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py") system("python get-pip.py") system("pip3 install virtualenv") install.packages("keras") keras::install_keras() devtools::install_github("adityamangal410/deepSentimentR")
Visualize polarity frequency based on given filters:
library(dplyr) library(deepSentimentR) data("sentiment140_train") sentiment140_train %>% freq_by_polarity(user_list = c("", "mcraddictal"), start_date_time = lubridate::as_datetime("2009-05-30"), end_date_time = lubridate::as_datetime("2009-06-03"), keyword_list = c(""))
Use pre-trained LSTM model using Glove Embeddings to make polarity predictions for the sample test dataset:
predict_polarity_keras(model_load_path = system.file("extdata", "train_glove_lstm.rds", package = "deepSentimentR", mustWork = TRUE))
Check out full reference and examples at - https://adityamangal410.github.io/deepSentimentR/
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.