detect_sentiment
¶
detect_sentiment(
text: CustomerInputString,
language_code: LanguageCode,
*,
config_overrides: Optional[ComprehendClientConfig] = None,
) -> DetectSentimentResponse
Inspects text and returns an inference of the prevailing sentiment (POSITIVE, NEUTRAL, MIXED, or NEGATIVE).
Parameters:
-
text(CustomerInputString) –A UTF-8 text string. The maximum string size is 5 KB.
-
language_code(LanguageCode) –The language of the input documents. You can specify any of the primary languages supported by Amazon Comprehend. All documents must be in the same language.
Raises:
-
InternalServerException–An internal server error occurred. Retry your request.
-
InvalidRequestException–The request is invalid.
-
TextSizeLimitExceededException–The size of the input text exceeds the limit. Use a smaller document.
-
UnsupportedLanguageException–Amazon Comprehend can't process the language of the input text. For a list of supported languages, Supported languages in the Comprehend Developer Guide.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_comprehend/_services/comprehend.py
3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 | |