Provide a character string with your text, your API key and what scores you want to obtain.

prsp_score(
  text,
  text_id = NULL,
  languages = NULL,
  score_sentences = F,
  score_model,
  sleep = 1,
  doNotStore = F,
  key = NULL
)

Arguments

text

a character string.

text_id

a unique ID for the text that you supply (required).

languages

A vector of ISO 631-1 two-letter language codes specifying the language(s) that comment is in (for example, "en", "es", "fr", "de", etc). If unspecified, the API will autodetect the comment language. If language detection fails, the API returns an error.

score_sentences

A boolean value that indicates if the request should return spans that describe the scores for each part of the text (currently done at per sentence level). Defaults to FALSE.

score_model

Specify what model do you want to use (for example TOXICITY and/or SEVERE_TOXICITY). Specify a character vector if you want more than one score. See peRspective::prsp_models.

sleep

how long should prsp_score wait between each call

doNotStore

Whether the API is permitted to store comment from this request. Stored comments will be used for future research and community model building purposes to improve the API over time. Perspective API also plans to provide dashboards and automated analysis of the comments submitted, which will apply only to those stored. Defaults to FALSE (request data may be stored). Important note: This should be set to true if data being submitted is private (i.e. not publicly accessible), or if the data submitted contains content written by someone under 13 years old.

key

Your API key (see here to set up an API key).

Value

a tibble

Details

For more details see ?peRspective or Perspective API documentation

Examples

if (FALSE) { ## GET TOXICITY SCORES for a comment prsp_score("Hello, I am a test comment!", score_model = "TOXICITY") ## GET TOXICITY and SEVERE_TOXICITY Scores for a comment prsp_score("Hello, I am a test comment!", score_model = c("TOXICITY", "SEVERE_TOXICITY")) ## GET TOXICITY and SEVERE_TOXICITY Scores for each sentence of a comment prsp_score("Hello, I am a test comment! I am a second sentence and I will (hopefully) be scored seperately", score_model = c("TOXICITY", "SEVERE_TOXICITY"), score_sentences = T) }