README.md

remoodji

R-CMD-check codecov

Remoodji is a text analysis package that focuses on sentiment analysis in text files in quantitative and qualitative ways. Specifically, it is used for determining what kind of underlying emotion your input text gives off and quantitative analyses of your text (character, word, and sentence count as well as visual and quantitative sentiment analysis). The emotions analyzed include angry, sad, happy, and disgust. Another core feature of Remoodji is it replaces words with emojis to provide the user with a text file where it is easier to pick up on the emotions being conveyed in a visually appealing snapshot view. This package can be useful when proofreading an important message which you want to elicit a certain emotion or tone, particularly with a given pattern or rhythm (speeches, letters, applications, songs, poems, etc).

Installation

You can install the released version of remoodji from CRAN with:

install.packages("remoodji")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("UBC-MDS/remoodji")

Functions

Counter:

Sentiment Analysis Dataframe:

Character Replacement:

Sentiment Analysis Plot:

Usage

Here is a example of how this package could be used. Let’s say there is a statement that you are trying to analyze. This is how you could implement our package.

First you need to import this package with the following command:

library('remoodji')

Let’s say you have the following statement:

I was happily walking. I then saw a monster and I got scared. However, when I found out it was a prank I became angry instead.

To start you might want to first determine the number of characters, words, and sentences to ensure that your statement fits within guidelines.

counter('I was happily walking. I then saw a monster and I got scared. However, when I found out it was a prank I became angry instead.')

This would output a tibble with the following values:

char_count word_count sentence_count 126 26 3

After you have some insight into the length of your statement you would want to get a dataframe that will provide you with some statistics about the emotional content of your statement. sentiment_df("I was happily walking. I then saw a monster and I got scared. However, when I found out it was a prank I became angry instead.")

word sentiment num_of_word word_sent_percentage sentiment_count angry anger 1 0.143 1 angry disgust 1 0.143 1 angry negative 1 0.143 3 found joy 1 0.143 2 found positive 1 0.143 2 found trust 1 0.143 1 happily joy 1 0.143 2 happily positive 1 0.143 2 monster fear 1 0.143 1 monster negative 1 0.143 3 prank negative 1 0.143 3 prank surprise 1 0.143 1

Now you might want to take this tabular / text data and turn it into a data visualization so that you can better understand the breakdown of emotions used in your statement.

sentiment_plot(text = "I was happily walking. I then saw a monster and I got scared. However, when I found out it was a prank I became angry instead.", sentiment_input = "all")

alt text

Also you could change the sentiment parameter to only see words with one type of sentiment

sentiment_plot(text = "This week, show us a smile (yours or someone else's), make us smile, or both. Share a photo of something that has brought a moment of joy into your life recently, or focus on the outcome of that joy. If you're not feeling particularly cheerful at the moment — it's still 2018, after all — no need to fake your way into the challenge, either. Smiles come in all shades and flavors, including the half-hearted, tired, bitter, and resigned (to name a few). So whether the emotions you channel in your photo are full of cheer or not, I can't wait to see your take on this theme." , sentiment_input = "joy")

alt text

Lastly, you might want to visualize the emotions in this statement in a different way. This packages allows you to see the emotional words replaced with corresponding emojis for each type of emotion. textsentiment_to_emoji("I was happily walking. I then saw a monster and I got scared. However, when I found out it was a prank I became angry instead.") “➕” “😨” “😄” “➖” “➖”

Contribution to Ecosystem

Dependencies

Contributors

Credits

This package was created with Devtools from R packages by Hadley Wickham and Jenny Bryan (https://r-pkgs.org/index.html).



UBC-MDS/remoodji documentation built on March 30, 2021, 12:02 p.m.