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 )
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 |
score_model | Specify what model do you want to use (for example |
sleep | how long should |
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 |
key | Your API key (see here to set up an API key). |
a tibble
For more details see ?peRspective
or Perspective API documentation
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) }