Description Usage Arguments Details Value Examples
This function wraps prsp_score
and loops over your text input. Provide a character string with your text and which scores you want to obtain. Make sure to keep track of your ratelimit with on the cloud console quota usage page.
1 2 3 4 5 6 7 8 9 10 |
.data |
a dataset with a text and text_id column. |
text |
a character vector with text you want to score. |
text_id |
a unique ID for the text that you supply (required) |
... |
arguments passed to |
safe_output |
wraps the function into a |
verbose |
narrates the streaming procedure (defaults to |
save |
NOT USABLE YET saves data into SQLite database (defaults to |
dt_name |
NOT USABLE YET what is the name of the dataset? (defaults to |
For more details see ?peRspective
or Perspective API documentation
a tibble
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 | ## Not run:
## Create a mock tibble
text_sample <- tibble(
ctext = c("You wrote this? Wow. This is dumb and childish, please go f**** yourself.",
"I don't know what to say about this but it's not good. The commenter is just an idiot",
"This goes even further!",
"What the hell is going on?",
"Please. I don't get it. Explain it again",
"Annoying and irrelevant! I'd rather watch the paint drying on the wall!"),
textid = c("#efdcxct", "#ehfcsct",
"#ekacxwt", "#ewatxad",
"#ekacswt", "#ewftxwd")
)
## GET TOXICITY and SEVERE_TOXICITY Scores for a dataset with a text column
text_sample %>%
prsp_stream(text = ctext,
text_id = textid,
score_model = c("TOXICITY", "SEVERE_TOXICITY"))
## Safe Output argument means will not stop on error
prsp_stream(text = ctext,
text_id = textid,
score_model = c("TOXICITY", "SEVERE_TOXICITY"),
safe_output = T)
## verbose = T means you get pretty narration of your scoring procedure
prsp_stream(text = ctext,
text_id = textid,
score_model = c("TOXICITY", "SEVERE_TOXICITY"),
safe_output = T,
verbose = T)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.