Sentiment

google.cloud.language.v1. Sentiment

Represents a Sentiment.

Constructor

new Sentiment(propertiesopt)

Constructs a new Sentiment.

Parameters:
Name Type Attributes Description
properties google.cloud.language.v1.ISentiment <optional>

Properties to set

Implements:
  • ISentiment

Members

magnitude

Sentiment magnitude.

score

Sentiment score.

Methods

(static) create(propertiesopt) → {google.cloud.language.v1.Sentiment}

Creates a new Sentiment instance using the specified properties.

Parameters:
Name Type Attributes Description
properties google.cloud.language.v1.ISentiment <optional>

Properties to set

Returns:
Type Description
google.cloud.language.v1.Sentiment

Sentiment instance

(static) decode(reader, lengthopt) → {google.cloud.language.v1.Sentiment}

Decodes a Sentiment message from the specified reader or buffer.

Parameters:
Name Type Attributes Description
reader $protobuf.Reader | Uint8Array

Reader or buffer to decode from

length number <optional>

Message length if known beforehand

Returns:
Type Description
google.cloud.language.v1.Sentiment

Sentiment

Throws:
  • If the payload is not a reader or valid buffer

    Type
    Error
  • If required fields are missing

    Type
    $protobuf.util.ProtocolError

(static) decodeDelimited(reader) → {google.cloud.language.v1.Sentiment}

Decodes a Sentiment message from the specified reader or buffer, length delimited.

Parameters:
Name Type Description
reader $protobuf.Reader | Uint8Array

Reader or buffer to decode from

Returns:
Type Description
google.cloud.language.v1.Sentiment

Sentiment

Throws:
  • If the payload is not a reader or valid buffer

    Type
    Error
  • If required fields are missing

    Type
    $protobuf.util.ProtocolError

(static) encode(message, writeropt) → {$protobuf.Writer}

Encodes the specified Sentiment message. Does not implicitly verify messages.

Parameters:
Name Type Attributes Description
message google.cloud.language.v1.ISentiment

Sentiment message or plain object to encode

writer $protobuf.Writer <optional>

Writer to encode to

Returns:
Type Description
$protobuf.Writer

Writer

(static) encodeDelimited(message, writeropt) → {$protobuf.Writer}

Encodes the specified Sentiment message, length delimited. Does not implicitly verify messages.

Parameters:
Name Type Attributes Description
message google.cloud.language.v1.ISentiment

Sentiment message or plain object to encode

writer $protobuf.Writer <optional>

Writer to encode to

Returns:
Type Description
$protobuf.Writer

Writer

(static) fromObject(object) → {google.cloud.language.v1.Sentiment}

Creates a Sentiment message from a plain object. Also converts values to their respective internal types.

Parameters:
Name Type Description
object Object.<string, *>

Plain object

Returns:
Type Description
google.cloud.language.v1.Sentiment

Sentiment

(static) toObject(message, optionsopt) → {Object.<string, *>}

Creates a plain object from a Sentiment message. Also converts values to other types if specified.

Parameters:
Name Type Attributes Description
message google.cloud.language.v1.Sentiment

Sentiment

options $protobuf.IConversionOptions <optional>

Conversion options

Returns:
Type Description
Object.<string, *>

Plain object

(static) verify(message) → {string|null}

Verifies a Sentiment message.

Parameters:
Name Type Description
message Object.<string, *>

Plain object to verify

Returns:
Type Description
string | null

null if valid, otherwise the reason why it is not

toJSON() → {Object.<string, *>}

Converts this Sentiment to JSON.

Returns:
Type Description
Object.<string, *>

JSON object