Reference documentation and code samples for the Cloud Natural Language V1 Client class Document.
Represents the input to API methods.
Generated from protobuf messagegoogle.cloud.language.v1.Document
Namespace
Google \ Cloud \ Language \ V1
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ type
int
Required. If the type is not set or isTYPE_UNSPECIFIED, returns anINVALID_ARGUMENTerror.
↳ content
string
The content of the input in string format. Cloud audit logging exempt since it is based on user data.
↳ gcs_content_uri
string
The Google Cloud Storage URI where the file content is located. This URI must be of the form: gs://bucket_name/object_name. For more details, seehttps://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.
↳ language
string
The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted. Language Supportlists currently supported languages for each API method. If the language (either specified by the caller or automatically detected) is not supported by the called API method, anINVALID_ARGUMENTerror is returned.
getType
Required. If the type is not set or isTYPE_UNSPECIFIED,
returns anINVALID_ARGUMENTerror.
Returns
Type
Description
int
setType
Required. If the type is not set or isTYPE_UNSPECIFIED,
returns anINVALID_ARGUMENTerror.
Parameter
Name
Description
var
int
Returns
Type
Description
$this
getContent
The content of the input in string format.
Cloud audit logging exempt since it is based on user data.
Returns
Type
Description
string
hasContent
setContent
The content of the input in string format.
Cloud audit logging exempt since it is based on user data.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getGcsContentUri
The Google Cloud Storage URI where the file content is located.
The language of the document (if not specified, the language is
automatically detected). Both ISO and BCP-47 language codes are
accepted. Language
Supportlists
currently supported languages for each API method. If the language (either
specified by the caller or automatically detected) is not supported by the
called API method, anINVALID_ARGUMENTerror is returned.
Returns
Type
Description
string
setLanguage
The language of the document (if not specified, the language is
automatically detected). Both ISO and BCP-47 language codes are
accepted. Language
Supportlists
currently supported languages for each API method. If the language (either
specified by the caller or automatically detected) is not supported by the
called API method, anINVALID_ARGUMENTerror is returned.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Cloud Natural Language V1 Client - Class Document (1.0.1)\n\nVersion latestkeyboard_arrow_down\n\n- [1.0.1 (latest)](/php/docs/reference/cloud-language/latest/V1.Document)\n- [1.0.0](/php/docs/reference/cloud-language/1.0.0/V1.Document)\n- [0.34.3](/php/docs/reference/cloud-language/0.34.3/V1.Document)\n- [0.33.0](/php/docs/reference/cloud-language/0.33.0/V1.Document)\n- [0.32.7](/php/docs/reference/cloud-language/0.32.7/V1.Document)\n- [0.31.3](/php/docs/reference/cloud-language/0.31.3/V1.Document)\n- [0.30.2](/php/docs/reference/cloud-language/0.30.2/V1.Document)\n- [0.29.0](/php/docs/reference/cloud-language/0.29.0/V1.Document)\n- [0.28.5](/php/docs/reference/cloud-language/0.28.5/V1.Document) \nReference documentation and code samples for the Cloud Natural Language V1 Client class Document.\n\nRepresents the input to API methods.\n\nGenerated from protobuf message `google.cloud.language.v1.Document`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Language \\\\ V1\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getType\n\nRequired. If the type is not set or is `TYPE_UNSPECIFIED`,\nreturns an `INVALID_ARGUMENT` error.\n\n### setType\n\nRequired. If the type is not set or is `TYPE_UNSPECIFIED`,\nreturns an `INVALID_ARGUMENT` error.\n\n### getContent\n\nThe content of the input in string format.\n\nCloud audit logging exempt since it is based on user data.\n\n### hasContent\n\n### setContent\n\nThe content of the input in string format.\n\nCloud audit logging exempt since it is based on user data.\n\n### getGcsContentUri\n\nThe Google Cloud Storage URI where the file content is located.\n\nThis URI must be of the form: gs://bucket_name/object_name. For more\ndetails, see \u003chttps://cloud.google.com/storage/docs/reference-uris\u003e.\nNOTE: Cloud Storage object versioning is not supported.\n\n### hasGcsContentUri\n\n### setGcsContentUri\n\nThe Google Cloud Storage URI where the file content is located.\n\nThis URI must be of the form: gs://bucket_name/object_name. For more\ndetails, see \u003chttps://cloud.google.com/storage/docs/reference-uris\u003e.\nNOTE: Cloud Storage object versioning is not supported.\n\n### getLanguage\n\nThe language of the document (if not specified, the language is\nautomatically detected). Both ISO and BCP-47 language codes are\naccepted. \n\n[Language\nSupport](https://cloud.google.com/natural-language/docs/languages) lists\ncurrently supported languages for each API method. If the language (either\nspecified by the caller or automatically detected) is not supported by the\ncalled API method, an `INVALID_ARGUMENT` error is returned.\n\n### setLanguage\n\nThe language of the document (if not specified, the language is\nautomatically detected). Both ISO and BCP-47 language codes are\naccepted. \n\n[Language\nSupport](https://cloud.google.com/natural-language/docs/languages) lists\ncurrently supported languages for each API method. If the language (either\nspecified by the caller or automatically detected) is not supported by the\ncalled API method, an `INVALID_ARGUMENT` error is returned.\n\n### getSource"]]