Reference documentation and code samples for the Cloud Natural Language V2 Client class ClassificationCategory.
Represents a category returned from the text classifier.
Generated from protobuf message google.cloud.language.v2.ClassificationCategory
Namespace
Google \ Cloud \ Language \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ name
string
The name of the category representing the document.
↳ confidence
float
The classifier's confidence of the category. Number represents how certain the classifier is that this category represents the given text.
↳ severity
float
Optional. The classifier's severity of the category. This is only present when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and the corresponding category has a severity score.
getName
The name of the category representing the document.
Returns
Type
Description
string
setName
The name of the category representing the document.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getConfidence
The classifier's confidence of the category. Number represents how certain
the classifier is that this category represents the given text.
Returns
Type
Description
float
setConfidence
The classifier's confidence of the category. Number represents how certain
the classifier is that this category represents the given text.
Parameter
Name
Description
var
float
Returns
Type
Description
$this
getSeverity
Optional. The classifier's severity of the category. This is only present
when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and
the corresponding category has a severity score.
Returns
Type
Description
float
setSeverity
Optional. The classifier's severity of the category. This is only present
when the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and
the corresponding category has a severity score.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[],[],null,["# Cloud Natural Language V2 Client - Class ClassificationCategory (1.0.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.1 (latest)](/php/docs/reference/cloud-language/latest/V2.ClassificationCategory)\n- [1.0.0](/php/docs/reference/cloud-language/1.0.0/V2.ClassificationCategory)\n- [0.34.3](/php/docs/reference/cloud-language/0.34.3/V2.ClassificationCategory)\n- [0.33.0](/php/docs/reference/cloud-language/0.33.0/V2.ClassificationCategory)\n- [0.32.7](/php/docs/reference/cloud-language/0.32.7/V2.ClassificationCategory)\n- [0.31.3](/php/docs/reference/cloud-language/0.31.3/V2.ClassificationCategory)\n- [0.30.2](/php/docs/reference/cloud-language/0.30.2/V2.ClassificationCategory)\n- [0.29.0](/php/docs/reference/cloud-language/0.29.0/V2.ClassificationCategory)\n- [0.28.5](/php/docs/reference/cloud-language/0.28.5/V2.ClassificationCategory) \nReference documentation and code samples for the Cloud Natural Language V2 Client class ClassificationCategory.\n\nRepresents a category returned from the text classifier.\n\nGenerated from protobuf message `google.cloud.language.v2.ClassificationCategory`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Language \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getName\n\nThe name of the category representing the document.\n\n### setName\n\nThe name of the category representing the document.\n\n### getConfidence\n\nThe classifier's confidence of the category. Number represents how certain\nthe classifier is that this category represents the given text.\n\n### setConfidence\n\nThe classifier's confidence of the category. Number represents how certain\nthe classifier is that this category represents the given text.\n\n### getSeverity\n\nOptional. The classifier's severity of the category. This is only present\nwhen the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and\nthe corresponding category has a severity score.\n\n### setSeverity\n\nOptional. The classifier's severity of the category. This is only present\nwhen the ModerateTextRequest.ModelVersion is set to MODEL_VERSION_2, and\nthe corresponding category has a severity score."]]