Skip to content

📜 TextBlob for R

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md
Notifications You must be signed in to change notification settings

news-r/textblob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Travis build status Lifecycle: experimental

textblob

Integrates TextBlob with R.

Installation

First, install the package using remotes.

# install.packages("remotes")
remotes::install_github("news-r/textblob")

Then install the python dependencies, only do this one per virtual environment.

# replace with path of your choice
my_env <- "./env"

# run this (works on unix)
args <- paste("-m venv", my_env) 
system2("python3", args) # create environment
reticulate::use_virtualenv(my_env) # force reticulate to use env
# install textblob in environment
textblob::install_textblob(my_env)

Then download the necessary NLTK datasets, note that there is a lite version.

# download corpora
textblob::download_corpora() 

This will install textblob and download the necessary NLTK corpora.

Example

library(textblob)

string <- paste(
  "R is a programmming langage and free software",
  "environment for statistical computing and",
  "graphics supported by the R Foundation for",
  "Statistical Computing."
)

wiki <- text_blob(string) 

wiki$sentiment # get sentiment
#> Sentiment(polarity=0.4, subjectivity=0.8)

wiki$correct() # correct programmming langage
#> R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing.

wiki$translate(to = "es") # translate
#> R es un lenguaje de programación y un entorno de software libre para computación estadística y gráficos soportados por la Fundación R para Computación Estadística.

About

📜 TextBlob for R

Topics

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages