Cloud Natural Language V1 Client - Class Token (0.29.0)

Reference documentation and code samples for the Cloud Natural Language V1 Client class Token.

Represents the smallest syntactic building block of the text.

Generated from protobuf message google.cloud.language.v1.Token

Methods

__construct

Constructor.

Parameters
NameDescription
data array

Optional. Data for populating the Message object.

↳ text Google\Cloud\Language\V1\TextSpan

The token text.

↳ part_of_speech Google\Cloud\Language\V1\PartOfSpeech

Parts of speech tag for this token.

↳ dependency_edge Google\Cloud\Language\V1\DependencyEdge

Dependency tree parse for this token.

↳ lemma string

Lemma of the token.

getText

The token text.

Returns
TypeDescription
Google\Cloud\Language\V1\TextSpan|null

hasText

clearText

setText

The token text.

Parameter
NameDescription
var Google\Cloud\Language\V1\TextSpan
Returns
TypeDescription
$this

getPartOfSpeech

Parts of speech tag for this token.

Returns
TypeDescription
Google\Cloud\Language\V1\PartOfSpeech|null

hasPartOfSpeech

clearPartOfSpeech

setPartOfSpeech

Parts of speech tag for this token.

Parameter
NameDescription
var Google\Cloud\Language\V1\PartOfSpeech
Returns
TypeDescription
$this

getDependencyEdge

Dependency tree parse for this token.

Returns
TypeDescription
Google\Cloud\Language\V1\DependencyEdge|null

hasDependencyEdge

clearDependencyEdge

setDependencyEdge

Dependency tree parse for this token.

Parameter
NameDescription
var Google\Cloud\Language\V1\DependencyEdge
Returns
TypeDescription
$this

getLemma

Lemma of the token.

Returns
TypeDescription
string

setLemma

Lemma of the token.

Parameter
NameDescription
var string
Returns
TypeDescription
$this