PHP Класс Google\Cloud\Speech\Operation

Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $speech = $cloud->speech(); $audioFileStream = fopen(__DIR__ . '/audio.flac', 'r'); $operation = $speech->beginRecognizeOperation( $audioFileStream );
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( Google\Cloud\Speech\Connection\ConnectionInterface $connection, string $name, array $info = [] )
exists ( array $options = [] ) : boolean Check whether or not the operation exists.
info ( array $options = [] ) : array Retrieves the operation's details. If no data is cached a network request will be made to retrieve it.
isComplete ( array $options = [] ) : boolean Check whether or not the operation is complete. A network request will be triggered if no cached data exists.
name ( ) : string Returns the operation's name.
reload ( array $options = [] ) : array Triggers a network request to reload the operation's details.
results ( array $options = [] ) : array Retrieves the results of the operation. A network request will be triggered if no cached data exists.

Описание методов

__construct() публичный метод

public __construct ( Google\Cloud\Speech\Connection\ConnectionInterface $connection, string $name, array $info = [] )
$connection Google\Cloud\Speech\Connection\ConnectionInterface Represents a connection to the Google Cloud Speech API.
$name string The operation's name.
$info array [optional] The operation's data.

exists() публичный метод

Example: if ($operation->exists()) { echo "The operation exists."; }
public exists ( array $options = [] ) : boolean
$options array [optional] Configuration Options.
Результат boolean

info() публичный метод

Example: $info = $operation->info(); print_r($info['response']);
См. также: https://cloud.google.com/speech/reference/rest/v1beta1/operations/get Operations get API documentation.
См. также: https://cloud.google.com/speech/reference/rest/v1beta1/operations#Operation Operation resource documentation.
public info ( array $options = [] ) : array
$options array [optional] Configuration Options.
Результат array

isComplete() публичный метод

Example: if ($operation->isComplete()) { echo "The operation is complete!"; }
public isComplete ( array $options = [] ) : boolean
$options array [optional] Configuration Options.
Результат boolean

name() публичный метод

Example: echo $operation->name();
public name ( ) : string
Результат string

reload() публичный метод

Example: $operation->reload(); $info = $operation->info(); print_r($info['response']);
См. также: https://cloud.google.com/speech/reference/rest/v1beta1/operations/get Operations get API documentation.
См. также: https://cloud.google.com/speech/reference/rest/v1beta1/operations#Operation Operation resource documentation.
public reload ( array $options = [] ) : array
$options array [optional] Configuration Options.
Результат array

results() публичный метод

Example: if ($operation->isComplete()) { $results = $operation->results(); }
См. также: https://cloud.google.com/speech/reference/rest/v1beta1/speech/syncrecognize#SpeechRecognitionAlternative SpeechRecognitionAlternative
public results ( array $options = [] ) : array
$options array [optional] Configuration Options.
Результат array The transcribed results. Each element of the array contains a `transcript` key which holds the transcribed text. Optionally a `confidence` key holding the confidence estimate ranging from 0.0 to 1.0 may be present. `confidence` is typically provided only for the top hypothesis.