Skip to content

Commit

Permalink
Remove interactive component for GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
ivelasq committed Oct 21, 2024
1 parent 6a0365b commit a3fdc7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions 11-wt-text-analysis.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ install.packages("textdata")
To explore this dataset more, we'll use a {tidytext} function called `get_sentiments()` to view some words and their associated sentiment. If this is your first time using the NRC Word-Emotion Association Lexicon, you'll be prompted to download the NRC lexicon. Respond "yes" to the prompt and the NRC lexicon will download. Note that you'll only have to do this the first time you use the NRC lexicon.

```{r view nrc}
get_sentiments("nrc")
#| include: false
nrc_sentiments <- read_rds("data/nrc_sentiments.Rds")
```

```{r view nrc}
#| eval: false
nrc_sentiments <- get_sentiments("nrc")
```

This returns a dataset with two columns. The first is `word` and contains a list of words. The second is the `sentiment` column, which contains an emotion associated with each word. This dataset is similar to the `stop_words` dataset. Note that this dataset also uses the column name `word`, which will again make it easy for us to match this dataset to our `tokens` dataset.
Expand All @@ -198,8 +204,8 @@ Let's begin working on reducing our `tokens` dataset down to only words that the
```{r count positive words}
# Only positive in the NRC dataset
nrc_pos <-
get_sentiments("nrc") %>%
filter(sentiment == "positive")
nrc_sentiments %>%
filter(sentiment == "positive")
# Match to tokens
pos_tokens_count <-
Expand Down
Binary file added data/nrc_sentiments.Rds
Binary file not shown.

0 comments on commit a3fdc7b

Please sign in to comment.