PeRspective
An R wrapper for Conversation AI's Perspective API
Install / Use
/learn @favstats/PeRspectiveREADME
peRspective <img src="man/figures/perspective.png" width="160px" align="right"/>
Perspective is an API that uses machine learning models to score the perceived impact a comment might have on a conversation. Website.
peRspective provides access to the API using the R programming
language.
For an excellent documentation of the Perspective API see here.
This is a work-in-progress project and I welcome feedback and pull requests!
Overview
Setup
Get an API key
Follow these steps as outlined by the Perspective API to get an API key.
NOTE: Perspective API made some changes recently and you now have to apply for an API key via a Google Form.
Quota and character length Limits
Be sure to check your quota limit! You can learn more about Perspective API quota limit by visiting your google cloud project’s Perspective API page.
Models
For detailed overview of the used models see here.
Languages in production
Currently, Perspective API has production TOXICITY and
SEVERE_TOXICITY attributes in the following languages:
- English (en)
- Spanish (es)
- French (fr)
- German (de)
- Portuguese (pt)
- Italian (it)
- Russian (ru)
Toxicity attributes
| Attribute name | Type | Description | Available Languages |
|--------------------------------|-------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| TOXICITY | prod. | A rude, disrespectful, or unreasonable comment that is likely to make people leave a discussion. | English (en), Spanish (es), French (fr), German (de), Portuguese (pt), Italian (it), Russian (ru) |
| TOXICITY_EXPERIMENTAL | exp. | A rude, disrespectful, or unreasonable comment that is likely to make people leave a discussion. | Arabic (ar) |
| SEVERE_TOXICITY | prod. | A very hateful, aggressive, disrespectful comment or otherwise very likely to make a user leave a discussion or give up on sharing their perspective. This attribute is much less sensitive to more mild forms of toxicity, such as comments that include positive uses of curse words. | en, fr, es, de, it, pt, ru |
| SEVERE_TOXICITY_EXPERIMENTAL | exp. | A very hateful, aggressive, disrespectful comment or otherwise very likely to make a user leave a discussion or give up on sharing their perspective. This attribute is much less sensitive to more mild forms of toxicity, such as comments that include positive uses of curse words. | ar |
| IDENTITY_ATTACK | prod. | Negative or hateful comments targeting someone because of their identity. | de, it, pt, ru, en |
| IDENTITY_ATTACK_EXPERIMENTAL | exp. | Negative or hateful comments targeting someone because of their identity. | fr, es, ar |
| INSULT | prod. | Insulting, inflammatory, or negative comment towards a person or a group of people. | de, it, pt, ru, en |
| INSULT_EXPERIMENTAL | exp. | Insulting, inflammatory, or negative comment towards a person or a group of people. | fr, es, ar |
| PROFANITY | prod. | Swear words, curse words, or other obscene or profane language. | de, it, pt, ru, en |
| PROFANITY_EXPERIMENTAL | exp. | Swear words, curse words, or other obscene or profane language. | fr, es, ar |
| THREAT | prod. | Describes an intention to inflict pain, injury, or violence against an individual or group. | de, it, pt, ru, en |
| THREAT_EXPERIMENTAL | exp. | Describes an intention to inflict pain, injury, or violence against an individual or group. | fr, es, ar |
| SEXUALLY_EXPLICIT | exp. | Contains references to sexual acts, body parts, or other lewd content. | en |
| FLIRTATION | exp. | Pickup lines, complimenting appearance, subtle sexual innuendos, etc. | en |
New York Times attributes
These attributes are experimental because they are trained on a single source of comments—New York Times (NYT) data tagged by their moderation team—and therefore may not work well for every use case.
| Attribute name | Type | Description | Language | |-----------------------|------|--------------------------------------------
Related Skills
ai-cmo
Collection of my Agent Skills and books.
next
A beautifully designed, floating Pomodoro timer that respects your workspace.
product-manager-skills
31PM skill for Claude Code, Codex, Cursor, and Windsurf: diagnose SaaS metrics, critique PRDs, plan roadmaps, run discovery, and coach PM career transitions.
devplan-mcp-server
3MCP server for generating development plans, project roadmaps, and task breakdowns for Claude Code. Turn project ideas into paint-by-numbers implementation plans.
