Google Cloud Natural Language v1 API - Class Document (3.7.0)

public sealed class Document : IMessage<Document>, IEquatable<Document>, IDeepCloneable<Document>, IBufferMessage, IMessage

Reference documentation and code samples for the Google Cloud Natural Language v1 API class Document.

Represents the input to API methods.

Inheritance

object > Document

Namespace

Google.Cloud.Language.V1

Assembly

Google.Cloud.Language.V1.dll

Constructors

Document()

public Document()

Document(Document)

public Document(Document other)
Parameter
Name Description
other Document

Properties

Content

public string Content { get; set; }

The content of the input in string format. Cloud audit logging exempt since it is based on user data.

Property Value
Type Description
string

GcsContentUri

public string GcsContentUri { get; set; }

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, see https://cloud.google.com/storage/docs/reference-uris. NOTE: Cloud Storage object versioning is not supported.

Property Value
Type Description
string

HasContent

public bool HasContent { get; }

Gets whether the "content" field is set

Property Value
Type Description
bool

HasGcsContentUri

public bool HasGcsContentUri { get; }

Gets whether the "gcs_content_uri" field is set

Property Value
Type Description
bool

Language

public string Language { get; set; }

The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted.<br> Language Support lists 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, an INVALID_ARGUMENT error is returned.

Property Value
Type Description
string

SourceCase

public Document.SourceOneofCase SourceCase { get; }
Property Value
Type Description
DocumentSourceOneofCase

Type

public Document.Types.Type Type { get; set; }

Required. If the type is not set or is TYPE_UNSPECIFIED, returns an INVALID_ARGUMENT error.

Property Value
Type Description
DocumentTypesType

Methods

FromHtml(string, string)

public static Document FromHtml(string html, string language = null)

Constructs a document from an HTML string and optional language.

Parameters
Name Description
html string

The HTML text of the document. Must not be null.

language string

The language of the document, as an ISO or BCP-47 language code. This may be empty or null (the default), in which case the language will be detected by the Natural Language service.

Returns
Type Description
Document

The newly created document.

FromPlainText(string, string)

public static Document FromPlainText(string text, string language = null)

Constructs a document from a plain text string and optional language.

Parameters
Name Description
text string

The text of the document. Must not be null.

language string

The language of the document, as an ISO or BCP-47 language code. This may be empty or null (the default), in which case the language will be detected by the Natural Language service.

Returns
Type Description
Document

The newly created document.