{
  "id": "commentanalyzer:v1alpha1",
  "discoveryVersion": "v1",
  "kind": "discovery#restDescription",
  "name": "commentanalyzer",
  "canonicalName": "Comment Analyzer",
  "revision": "20260504",
  "rootUrl": "https://commentanalyzer.googleapis.com/",
  "parameters": {
    "fields": {
      "type": "string",
      "description": "Selector specifying which fields to include in a partial response.",
      "location": "query"
    },
    "uploadType": {
      "type": "string",
      "description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").",
      "location": "query"
    },
    "$.xgafv": {
      "enum": [
        "1",
        "2"
      ],
      "enumDescriptions": [
        "v1 error format",
        "v2 error format"
      ],
      "location": "query",
      "type": "string",
      "description": "V1 error format."
    },
    "callback": {
      "type": "string",
      "description": "JSONP",
      "location": "query"
    },
    "oauth_token": {
      "type": "string",
      "description": "OAuth 2.0 token for the current user.",
      "location": "query"
    },
    "access_token": {
      "type": "string",
      "description": "OAuth access 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"
    },
    "alt": {
      "enum": [
        "json",
        "media",
        "proto"
      ],
      "enumDescriptions": [
        "Responses with Content-Type of application/json",
        "Media download with context-dependent Content-Type",
        "Responses with Content-Type of application/x-protobuf"
      ],
      "default": "json",
      "location": "query",
      "type": "string",
      "description": "Data format for response."
    },
    "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"
    },
    "prettyPrint": {
      "type": "boolean",
      "description": "Returns response with indentations and line breaks.",
      "default": "true",
      "location": "query"
    },
    "upload_protocol": {
      "type": "string",
      "description": "Upload protocol for media (e.g. \"raw\", \"multipart\").",
      "location": "query"
    }
  },
  "ownerDomain": "google.com",
  "icons": {
    "x16": "http://www.google.com/images/icons/product/search-16.gif",
    "x32": "http://www.google.com/images/icons/product/search-32.gif"
  },
  "auth": {
    "oauth2": {
      "scopes": {
        "https://www.googleapis.com/auth/userinfo.email": {
          "description": "See your primary Google Account email address"
        }
      }
    }
  },
  "version_module": true,
  "resources": {
    "comments": {
      "methods": {
        "analyze": {
          "path": "v1alpha1/comments:analyze",
          "httpMethod": "POST",
          "description": "Analyzes the provided text and returns scores for requested attributes.",
          "response": {
            "$ref": "AnalyzeCommentResponse"
          },
          "scopes": [
            "https://www.googleapis.com/auth/userinfo.email"
          ],
          "parameters": {},
          "id": "commentanalyzer.comments.analyze",
          "request": {
            "$ref": "AnalyzeCommentRequest"
          },
          "parameterOrder": [],
          "flatPath": "v1alpha1/comments:analyze"
        },
        "suggestscore": {
          "flatPath": "v1alpha1/comments:suggestscore",
          "parameterOrder": [],
          "request": {
            "$ref": "SuggestCommentScoreRequest"
          },
          "id": "commentanalyzer.comments.suggestscore",
          "parameters": {},
          "response": {
            "$ref": "SuggestCommentScoreResponse"
          },
          "scopes": [
            "https://www.googleapis.com/auth/userinfo.email"
          ],
          "path": "v1alpha1/comments:suggestscore",
          "httpMethod": "POST",
          "description": "Suggest comment scores as training data."
        }
      }
    }
  },
  "servicePath": "",
  "batchPath": "batch",
  "ownerName": "Google",
  "title": "Perspective Comment Analyzer API",
  "version": "v1alpha1",
  "schemas": {
    "AttributeScores": {
      "properties": {
        "spanScores": {
          "items": {
            "$ref": "SpanScore"
          },
          "description": "Per-span scores.",
          "type": "array"
        },
        "summaryScore": {
          "description": "Overall score for comment as a whole.",
          "$ref": "Score"
        }
      },
      "description": "This holds score values for a single attribute. It contains both per-span scores as well as an overall summary score..",
      "type": "object",
      "id": "AttributeScores"
    },
    "Score": {
      "properties": {
        "value": {
          "description": "Score value. Semantics described by type below.",
          "type": "number",
          "format": "float"
        },
        "type": {
          "enum": [
            "SCORE_TYPE_UNSPECIFIED",
            "PROBABILITY",
            "STD_DEV_SCORE",
            "PERCENTILE",
            "RAW"
          ],
          "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."
          ],
          "description": "The type of the above value.",
          "type": "string"
        }
      },
      "id": "Score",
      "description": "Analysis scores are described by a value and a ScoreType.",
      "type": "object"
    },
    "SuggestCommentScoreRequest": {
      "properties": {
        "comment": {
          "description": "The comment being scored.",
          "$ref": "TextEntry"
        },
        "languages": {
          "items": {
            "type": "string"
          },
          "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"
        },
        "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"
        },
        "clientToken": {
          "description": "Opaque token that is echoed from the request to the response.",
          "type": "string"
        },
        "context": {
          "description": "The context of the comment.",
          "$ref": "Context"
        },
        "communityId": {
          "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.",
          "type": "string"
        },
        "attributeScores": {
          "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.",
          "type": "object"
        }
      },
      "description": "The comment score suggestion request message.",
      "type": "object",
      "id": "SuggestCommentScoreRequest"
    },
    "SuggestCommentScoreResponse": {
      "properties": {
        "detectedLanguages": {
          "items": {
            "type": "string"
          },
          "description": "The list of languages detected from the comment text.",
          "type": "array"
        },
        "clientToken": {
          "description": "Same token from the original SuggestCommentScoreRequest.",
          "type": "string"
        },
        "requestedLanguages": {
          "description": "The list of languages provided in the request.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "id": "SuggestCommentScoreResponse",
      "description": "The comment score suggestion response message.",
      "type": "object"
    },
    "ArticleAndParentComment": {
      "properties": {
        "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"
        },
        "article": {
          "description": "The source content about which the comment was made (article text, article summary, video transcript, etc).",
          "$ref": "TextEntry"
        }
      },
      "id": "ArticleAndParentComment",
      "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.",
      "type": "object"
    },
    "AnalyzeCommentRequest": {
      "properties": {
        "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"
        },
        "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"
        },
        "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"
        },
        "dropUnsupportedAttributes": {
          "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.",
          "type": "boolean"
        },
        "requestedAttributes": {
          "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.",
          "type": "object",
          "additionalProperties": {
            "$ref": "AttributeParameters"
          }
        },
        "context": {
          "description": "The context of the comment.",
          "$ref": "Context"
        },
        "clientToken": {
          "description": "Opaque token that is echoed from the request to the response.",
          "type": "string"
        },
        "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": {
          "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.",
          "type": "array"
        },
        "comment": {
          "description": "The comment to analyze.",
          "$ref": "TextEntry"
        }
      },
      "description": "The comment analysis request message. Next ID: 13",
      "type": "object",
      "id": "AnalyzeCommentRequest"
    },
    "TextEntry": {
      "id": "TextEntry",
      "description": "Represents a body of text.",
      "type": "object",
      "properties": {
        "type": {
          "description": "Type of the text field.",
          "type": "string",
          "enumDescriptions": [
            "The content type is not specified. Text will be interpreted as plain text by default.",
            "Plain text.",
            "HTML."
          ],
          "enum": [
            "TEXT_TYPE_UNSPECIFIED",
            "PLAIN_TEXT",
            "HTML"
          ]
        },
        "text": {
          "description": "UTF-8 encoded text.",
          "type": "string"
        }
      }
    },
    "SpanScore": {
      "description": "This is a single score for a given span of text.",
      "type": "object",
      "id": "SpanScore",
      "properties": {
        "end": {
          "type": "integer",
          "format": "int32"
        },
        "score": {
          "description": "The score value.",
          "$ref": "Score"
        },
        "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.",
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "Context": {
      "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.",
      "type": "object",
      "id": "Context",
      "properties": {
        "articleAndParentComment": {
          "description": "Information about the source for which the original comment was made, and any parent comment info.",
          "$ref": "ArticleAndParentComment"
        },
        "entries": {
          "description": "A list of messages. For example, a linear comments section or forum thread.",
          "type": "array",
          "items": {
            "$ref": "TextEntry"
          }
        }
      }
    },
    "AnalyzeCommentResponse": {
      "description": "The comment analysis response message.",
      "type": "object",
      "id": "AnalyzeCommentResponse",
      "properties": {
        "attributeScores": {
          "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).",
          "type": "object",
          "additionalProperties": {
            "$ref": "AttributeScores"
          }
        },
        "clientToken": {
          "description": "Same token from the original AnalyzeCommentRequest.",
          "type": "string"
        },
        "detectedLanguages": {
          "description": "Contains the languages detected from the text content, sorted in order of likelihood.",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "languages": {
          "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]",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "AttributeParameters": {
      "id": "AttributeParameters",
      "description": "Configurable parameters for attribute scoring.",
      "type": "object",
      "properties": {
        "scoreType": {
          "description": "What type of scores to return. If unset, defaults to probability scores.",
          "type": "string",
          "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."
          ],
          "enum": [
            "SCORE_TYPE_UNSPECIFIED",
            "PROBABILITY",
            "STD_DEV_SCORE",
            "PERCENTILE",
            "RAW"
          ]
        },
        "scoreThreshold": {
          "format": "float",
          "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"
        }
      }
    }
  },
  "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.",
  "baseUrl": "https://commentanalyzer.googleapis.com/",
  "mtlsRootUrl": "https://commentanalyzer.mtls.googleapis.com/",
  "documentationLink": "https://support.perspectiveapi.com",
  "basePath": "",
  "protocol": "rest"
}
