-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPerspective_analisis.Rmd
51 lines (38 loc) · 1.01 KB
/
Perspective_analisis.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
---
title: "Perspective_analisis"
output: html_notebook
---
```{r libraries}
library(peRspective)
library(tidyverse)
```
# Análisis de Toxicidad usando Perspective
## Cargar datos
```{r df}
tidy_threads <- read.csv('data/tidy_reform_jud_threads.csv')
tidy_tweets <- read.csv('data/tidy_reform_jud_twitter.csv')
```
## Preparar datos
```{r df2}
thr_txt <- tidy_threads %>%
select(item_id, datacaptiontext)
twi_txt <- tidy_tweets %>%
select(id, body)
```
## Evaluar toxicidad
```{r perspective}
toxic_thr <- thr_txt %>%
prsp_stream(text = datacaptiontext,
text_id = item_id,
languages = "es",
score_model = c("TOXICITY", "INSULT", "PROFANITY_EXPERIMENTAL"),
verbose = T,
safe_output = T)
toxic_twt <- twi_txt %>%
prsp_stream(text = body,
text_id = id,
languages = "es",
score_model = c("TOXICITY", "INSULT", "PROFANITY_EXPERIMENTAL"),
verbose = T,
safe_output = T)
```