{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-cloud-natural-language/json-schema/google-cloud-natural-language-analyze-sentiment-response-schema.json",
  "title": "AnalyzeSentimentResponse",
  "description": "The sentiment analysis response message.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-cloud-natural-language-documents-api-openapi.yml#/components/schemas/AnalyzeSentimentResponse",
  "type": "object",
  "properties": {
    "languageCode": {
      "description": "The language of the text, which will be the same as the language specified in the request or, if not specified, the automatically-detected language. See Document.language_code field for more details.",
      "type": "string"
    },
    "documentSentiment": {
      "$ref": "#/$defs/Sentiment",
      "description": "The overall sentiment of the input document."
    },
    "languageSupported": {
      "description": "Whether the language is officially supported. The API may still return a response when the language is not supported, but it is on a best effort basis.",
      "type": "boolean"
    },
    "sentences": {
      "description": "The sentiment for all the sentences in the document.",
      "items": {
        "$ref": "#/$defs/Sentence"
      },
      "type": "array"
    }
  },
  "$defs": {
    "Sentence": {
      "description": "Represents a sentence in the input document.",
      "type": "object",
      "properties": {
        "sentiment": {
          "$ref": "#/$defs/Sentiment",
          "description": "For calls to AnalyzeSentiment or if AnnotateTextRequest.Features.extract_document_sentiment is set to true, this field will contain the sentiment for the sentence."
        },
        "text": {
          "$ref": "#/$defs/TextSpan",
          "description": "The sentence text."
        }
      }
    },
    "Sentiment": {
      "properties": {
        "magnitude": {
          "format": "float",
          "type": "number",
          "description": "A non-negative number in the [0, +inf] range, which represents the absolute magnitude of sentiment regardless of score (positive or negative)."
        },
        "score": {
          "format": "float",
          "type": "number",
          "description": "Sentiment score between -1.0 (negative sentiment) and 1.0 (positive sentiment)."
        }
      },
      "description": "Represents the feeling associated with the entire text or entities in the text.",
      "type": "object"
    },
    "TextSpan": {
      "type": "object",
      "properties": {
        "content": {
          "description": "The content of the text span, which is a substring of the document.",
          "type": "string"
        },
        "beginOffset": {
          "type": "integer",
          "description": "The API calculates the beginning offset of the content in the original document according to the EncodingType specified in the API request.",
          "format": "int32"
        }
      },
      "description": "Represents a text span in the input document."
    }
  }
}