{
  "discoveryVersion": "v1",
  "resources": {
    "comments": {
      "methods": {
        "suggestscore": {
          "path": "v1alpha1/comments:suggestscore",
          "response": {
            "$ref": "SuggestCommentScoreResponse"
          },
          "parameterOrder": [],
          "id": "commentanalyzer.comments.suggestscore",
          "httpMethod": "POST",
          "description": "Suggest comment scores as training data.",
          "request": {
            "$ref": "SuggestCommentScoreRequest"
          },
          "flatPath": "v1alpha1/comments:suggestscore",
          "parameters": {},
          "scopes": [
            "https://www.googleapis.com/auth/userinfo.email"
          ]
        },
        "analyze": {
          "path": "v1alpha1/comments:analyze",
          "response": {
            "$ref": "AnalyzeCommentResponse"
          },
          "parameterOrder": [],
          "id": "commentanalyzer.comments.analyze",
          "httpMethod": "POST",
          "description": "Analyzes the provided text and returns scores for requested attributes.",
          "request": {
            "$ref": "AnalyzeCommentRequest"
          },
          "scopes": [
            "https://www.googleapis.com/auth/userinfo.email"
          ],
          "flatPath": "v1alpha1/comments:analyze",
          "parameters": {}
        }
      }
    }
  },
  "icons": {
    "x16": "http://www.google.com/images/icons/product/search-16.gif",
    "x32": "http://www.google.com/images/icons/product/search-32.gif"
  },
  "version_module": true,
  "baseUrl": "https://commentanalyzer.googleapis.com/",
  "description": "The Perspective Comment Analyzer API provides information about the potential impact of a comment on a conversation (e.g. it can provide a score for the \"toxicity\" of a comment). Users can leverage the \"SuggestCommentScore\" method to submit corrections to improve Perspective over time. Users can set the \"doNotStore\" flag to ensure that all submitted comments are automatically deleted after scores are returned.",
  "protocol": "rest",
  "ownerDomain": "google.com",
  "basePath": "",
  "batchPath": "batch",
  "rootUrl": "https://commentanalyzer.googleapis.com/",
  "version": "v1alpha1",
  "parameters": {
    "access_token": {
      "description": "OAuth access token.",
      "location": "query",
      "type": "string"
    },
    "alt": {
      "enumDescriptions": [
        "Responses with Content-Type of application/json",
        "Media download with context-dependent Content-Type",
        "Responses with Content-Type of application/x-protobuf"
      ],
      "description": "Data format for response.",
      "default": "json",
      "location": "query",
      "enum": [
        "json",
        "media",
        "proto"
      ],
      "type": "string"
    },
    "oauth_token": {
      "description": "OAuth 2.0 token for the current user.",
      "location": "query",
      "type": "string"
    },
    "key": {
      "type": "string",
      "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
      "location": "query"
    },
    "quotaUser": {
      "type": "string",
      "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.",
      "location": "query"
    },
    "uploadType": {
      "type": "string",
      "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").",
      "location": "query"
    },
    "fields": {
      "description": "Selector specifying which fields to include in a partial response.",
      "location": "query",
      "type": "string"
    },
    "callback": {
      "type": "string",
      "description": "JSONP",
      "location": "query"
    },
    "upload_protocol": {
      "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").",
      "location": "query",
      "type": "string"
    },
    "prettyPrint": {
      "description": "Returns response with indentations and line breaks.",
      "default": "true",
      "location": "query",
      "type": "boolean"
    },
    "$.xgafv": {
      "enum": [
        "1",
        "2"
      ],
      "enumDescriptions": [
        "v1 error format",
        "v2 error format"
      ],
      "description": "V1 error format.",
      "location": "query",
      "type": "string"
    }
  },
  "schemas": {
    "TextEntry": {
      "id": "TextEntry",
      "type": "object",
      "description": "Represents a body of text.",
      "properties": {
        "type": {
          "enumDescriptions": [
            "The content type is not specified. Text will be interpreted as plain text by default.",
            "Plain text.",
            "HTML."
          ],
          "description": "Type of the text field.",
          "type": "string",
          "enum": [
            "TEXT_TYPE_UNSPECIFIED",
            "PLAIN_TEXT",
            "HTML"
          ]
        },
        "text": {
          "description": "UTF-8 encoded text.",
          "type": "string"
        }
      }
    },
    "AnalyzeCommentResponse": {
      "id": "AnalyzeCommentResponse",
      "type": "object",
      "description": "The comment analysis response message.",
      "properties": {
        "clientToken": {
          "type": "string",
          "description": "Same token from the original AnalyzeCommentRequest."
        },
        "detectedLanguages": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Contains the languages detected from the text content, sorted in order of likelihood."
        },
        "attributeScores": {
          "type": "object",
          "description": "Scores for the requested attributes. The map keys are attribute names (same as the requested_attribute field in AnalyzeCommentRequest, for example \"ATTACK_ON_AUTHOR\", \"INFLAMMATORY\", etc).",
          "additionalProperties": {
            "$ref": "AttributeScores"
          }
        },
        "languages": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The language(s) used by CommentAnalyzer service to choose which Model to use when analyzing the comment. Might better be called \"effective_languages\". The logic used to make the choice is as follows: if !Request.languages.empty() effective_languages = Request.languages else effective_languages = detected_languages[0]"
        }
      }
    },
    "AnalyzeCommentRequest": {
      "description": "The comment analysis request message. Next ID: 13",
      "properties": {
        "communityId": {
          "description": "Optional identifier associating this AnalyzeCommentRequest with a particular client's community. Different communities may have different norms and rules. Specifying this value enables us to explore building community-specific models for clients.",
          "type": "string"
        },
        "comment": {
          "description": "The comment to analyze.",
          "$ref": "TextEntry"
        },
        "requestedAttributes": {
          "type": "object",
          "additionalProperties": {
            "$ref": "AttributeParameters"
          },
          "description": "Specification of requested attributes. The AttributeParameters serve as configuration for each associated attribute. The map keys are attribute names. The available attributes may be different on each RFE installation, and can be seen by calling ListAttributes (see above). For the prod installation, known as Perspective API, see https://developers.perspectiveapi.com/s/about-the-api-model-cards."
        },
        "doNotStore": {
          "description": "Do not store the comment or context sent in this request. By default, the service may store comments/context for debugging purposes.",
          "type": "boolean"
        },
        "sessionId": {
          "type": "string",
          "description": "Session ID. Used to join related RPCs into a single session. For example, an interactive tool that calls both the AnalyzeComment and SuggestCommentScore RPCs should set all invocations of both RPCs to the same Session ID, typically a random 64-bit integer."
        },
        "dropUnsupportedAttributes": {
          "type": "boolean",
          "description": "If specified, any requested attribute that is requested but not supported for the language detected will be dropped from the returned scores instead of returning an error."
        },
        "spanAnnotations": {
          "description": "An advisory parameter that will return span annotations if the model is capable of providing scores with sub-comment resolution. This will likely increase the size of the returned message.",
          "type": "boolean"
        },
        "languages": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The language(s) of the comment and context. If none are specified, we attempt to automatically detect the language. Specifying multiple languages means the text contains multiple lanugages. Both ISO and BCP-47 language codes are accepted. The server returns an error if no language was specified and language detection fails. The server also returns an error if the languages (either specified by the caller, or auto-detected) are not *all* supported by the service."
        },
        "context": {
          "description": "The context of the comment.",
          "$ref": "Context"
        },
        "clientToken": {
          "description": "Opaque token that is echoed from the request to the response.",
          "type": "string"
        }
      },
      "id": "AnalyzeCommentRequest",
      "type": "object"
    },
    "SpanScore": {
      "id": "SpanScore",
      "type": "object",
      "description": "This is a single score for a given span of text.",
      "properties": {
        "score": {
          "$ref": "Score",
          "description": "The score value."
        },
        "end": {
          "type": "integer",
          "format": "int32"
        },
        "begin": {
          "description": "\"begin\" and \"end\" describe the span of the original text that the attribute score applies to. The values are the UTF-16 codepoint range. \"end\" is exclusive. For example, with the text \"Hi there\", the begin/end pair (0,2) describes the text \"Hi\". If \"begin\" and \"end\" are unset, the score applies to the full text.",
          "format": "int32",
          "type": "integer"
        }
      }
    },
    "ArticleAndParentComment": {
      "id": "ArticleAndParentComment",
      "type": "object",
      "description": "A type of context specific to a comment left on a single-threaded comment message board, where comments are either a top level comment or the child of a top level comment.",
      "properties": {
        "article": {
          "$ref": "TextEntry",
          "description": "The source content about which the comment was made (article text, article summary, video transcript, etc)."
        },
        "parentComment": {
          "description": "Refers to text that is a direct parent of the source comment, such as in a one-deep threaded message board. This field will only be present for comments that are replies to other comments and will not be populated for direct comments on the article_text.",
          "$ref": "TextEntry"
        }
      }
    },
    "Score": {
      "id": "Score",
      "type": "object",
      "description": "Analysis scores are described by a value and a ScoreType.",
      "properties": {
        "value": {
          "description": "Score value. Semantics described by type below.",
          "type": "number",
          "format": "float"
        },
        "type": {
          "type": "string",
          "enum": [
            "SCORE_TYPE_UNSPECIFIED",
            "PROBABILITY",
            "STD_DEV_SCORE",
            "PERCENTILE",
            "RAW"
          ],
          "description": "The type of the above value.",
          "enumDescriptions": [
            "Unspecified. Defaults to PROBABILITY scores if available, and otherwise RAW. Every model has a RAW score.",
            "Probability scores are in the range [0, 1] and indicate level of confidence in the attribute label.",
            "Standard deviation scores are in the range (-inf, +inf).",
            "Percentile scores are in the range [0, 1] and indicate the percentile of the raw score, normalized with a test dataset. This is not generally recommended, as the normalization is dependent on the dataset used, which may not match other usecases.",
            "Raw scores are the raw values from the model, and may take any value. This is primarily for debugging/testing, and not generally recommended."
          ]
        }
      }
    },
    "SuggestCommentScoreRequest": {
      "id": "SuggestCommentScoreRequest",
      "type": "object",
      "description": "The comment score suggestion request message.",
      "properties": {
        "clientToken": {
          "type": "string",
          "description": "Opaque token that is echoed from the request to the response."
        },
        "languages": {
          "description": "The language(s) of the comment and context. If none are specified, we attempt to automatically detect the language. Both ISO and BCP-47 language codes are accepted.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "communityId": {
          "type": "string",
          "description": "Optional identifier associating this comment score suggestion with a particular sub-community. Different communities may have different norms and rules. Specifying this value enables training community-specific models."
        },
        "sessionId": {
          "description": "Session ID. Used to join related RPCs into a single session. For example, an interactive tool that calls both the AnalyzeComment and SuggestCommentScore RPCs should set all invocations of both RPCs to the same Session ID, typically a random 64-bit integer.",
          "type": "string"
        },
        "comment": {
          "$ref": "TextEntry",
          "description": "The comment being scored."
        },
        "context": {
          "$ref": "Context",
          "description": "The context of the comment."
        },
        "attributeScores": {
          "type": "object",
          "additionalProperties": {
            "$ref": "AttributeScores"
          },
          "description": "Attribute scores for the comment. The map keys are attribute names, same as the requested_attribute field in AnalyzeCommentRequest (for example \"ATTACK_ON_AUTHOR\", \"INFLAMMATORY\", etc.). This field has the same type as the `attribute_scores` field in AnalyzeCommentResponse. To specify an overall attribute score for the entire comment as a whole, use the `summary_score` field of the mapped AttributeScores object. To specify scores on specific subparts of the comment, use the `span_scores` field. All SpanScore objects must have begin and end fields set. All Score objects must be explicitly set (for binary classification, use the score values 0 and 1). If Score objects don't include a ScoreType, `PROBABILITY` is assumed. `attribute_scores` must not be empty. The mapped AttributeScores objects also must not be empty. An `INVALID_ARGUMENT` error is returned for all malformed requests."
        }
      }
    },
    "Context": {
      "id": "Context",
      "type": "object",
      "description": "Context is typically something that a Comment is referencing or replying to (such as an article, or previous comment). Note: Populate only ONE OF the following fields. The oneof syntax cannot be used because that would require nesting entries inside another message and breaking backwards compatibility. The server will return an error if more than one of the following fields is present.",
      "properties": {
        "entries": {
          "type": "array",
          "items": {
            "$ref": "TextEntry"
          },
          "description": "A list of messages. For example, a linear comments section or forum thread."
        },
        "articleAndParentComment": {
          "$ref": "ArticleAndParentComment",
          "description": "Information about the source for which the original comment was made, and any parent comment info."
        }
      }
    },
    "AttributeParameters": {
      "id": "AttributeParameters",
      "type": "object",
      "description": "Configurable parameters for attribute scoring.",
      "properties": {
        "scoreThreshold": {
          "description": "Don't return scores for this attribute that are below this threshold. If unset, a default threshold will be applied. A FloatValue wrapper is used to distinguish between 0 vs. default/unset.",
          "type": "number",
          "format": "float"
        },
        "scoreType": {
          "type": "string",
          "enum": [
            "SCORE_TYPE_UNSPECIFIED",
            "PROBABILITY",
            "STD_DEV_SCORE",
            "PERCENTILE",
            "RAW"
          ],
          "description": "What type of scores to return. If unset, defaults to probability scores.",
          "enumDescriptions": [
            "Unspecified. Defaults to PROBABILITY scores if available, and otherwise RAW. Every model has a RAW score.",
            "Probability scores are in the range [0, 1] and indicate level of confidence in the attribute label.",
            "Standard deviation scores are in the range (-inf, +inf).",
            "Percentile scores are in the range [0, 1] and indicate the percentile of the raw score, normalized with a test dataset. This is not generally recommended, as the normalization is dependent on the dataset used, which may not match other usecases.",
            "Raw scores are the raw values from the model, and may take any value. This is primarily for debugging/testing, and not generally recommended."
          ]
        }
      }
    },
    "AttributeScores": {
      "description": "This holds score values for a single attribute. It contains both per-span scores as well as an overall summary score..",
      "properties": {
        "spanScores": {
          "description": "Per-span scores.",
          "type": "array",
          "items": {
            "$ref": "SpanScore"
          }
        },
        "summaryScore": {
          "description": "Overall score for comment as a whole.",
          "$ref": "Score"
        }
      },
      "id": "AttributeScores",
      "type": "object"
    },
    "SuggestCommentScoreResponse": {
      "id": "SuggestCommentScoreResponse",
      "type": "object",
      "description": "The comment score suggestion response message.",
      "properties": {
        "clientToken": {
          "type": "string",
          "description": "Same token from the original SuggestCommentScoreRequest."
        },
        "requestedLanguages": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The list of languages provided in the request."
        },
        "detectedLanguages": {
          "description": "The list of languages detected from the comment text.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  },
  "canonicalName": "Comment Analyzer",
  "kind": "discovery#restDescription",
  "title": "Perspective Comment Analyzer API",
  "name": "commentanalyzer",
  "servicePath": "",
  "revision": "20260105",
  "documentationLink": "https://support.perspectiveapi.com",
  "mtlsRootUrl": "https://commentanalyzer.mtls.googleapis.com/",
  "ownerName": "Google",
  "id": "commentanalyzer:v1alpha1",
  "auth": {
    "oauth2": {
      "scopes": {
        "https://www.googleapis.com/auth/userinfo.email": {
          "description": "See your primary Google Account email address"
        }
      }
    }
  }
}
