Movatterモバイル変換


[0]ホーム

URL:


speech

package
v0.257.0Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:14Imported by:0

Details

Repository

github.com/googleapis/google-api-go-client

Links

Documentation

Overview

Package speech provides access to the Cloud Speech-to-Text API.

This package is DEPRECATED. Use package cloud.google.com/go/speech/apiv1 instead.

For product documentation, see:https://cloud.google.com/speech-to-text/docs/quickstart-protocol

Creating a client

Usage example:

import "google.golang.org/api/speech/v2beta"...ctx := context.Background()speechService, err := speech.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, seehttps://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

speechService, err := speech.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}// ...token, err := config.Exchange(ctx, ...)speechService, err := speech.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

Seehttps://godoc.org/google.golang.org/api/option/ for details on options.

Index

Constants

View Source
const (// View and manage your data across Google Cloud Platform servicesCloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform")

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

typeListOperationsResponse

type ListOperationsResponse struct {// NextPageToken: The standard List next-page token.NextPageTokenstring `json:"nextPageToken,omitempty"`// Operations: A list of operations that matches the specified filter in// the request.Operations []*Operation `json:"operations,omitempty"`// ServerResponse contains the HTTP response code and headers from the// server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "NextPageToken") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "NextPageToken") to include// in API requests with the JSON null value. By default, fields with// empty values are omitted from API requests. However, any field with// an empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

ListOperationsResponse: The response message forOperations.ListOperations.

func (*ListOperationsResponse)MarshalJSON

func (s *ListOperationsResponse) MarshalJSON() ([]byte,error)

typeLongRunningRecognizeMetadata

type LongRunningRecognizeMetadata struct {// LastUpdateTime: Output only. Time of the most recent processing// update.LastUpdateTimestring `json:"lastUpdateTime,omitempty"`// ProgressPercent: Output only. Approximate percentage of audio// processed thus far. Guaranteed to be 100// when the audio is fully processed and the results are available.ProgressPercentint64 `json:"progressPercent,omitempty"`// StartTime: Output only. Time when the request was received.StartTimestring `json:"startTime,omitempty"`// ForceSendFields is a list of field names (e.g. "LastUpdateTime") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "LastUpdateTime") to// include in API requests with the JSON null value. By default, fields// with empty values are omitted from API requests. However, any field// with an empty value appearing in NullFields will be sent to the// server as null. It is an error if a field in this list has a// non-empty value. This may be used to include null fields in Patch// requests.NullFields []string `json:"-"`}

LongRunningRecognizeMetadata: Describes the progress of along-running `LongRunningRecognize` call. It isincluded in the `metadata` field of the `Operation` returned bythe`GetOperation` call of the `google::longrunning::Operations` service.

func (*LongRunningRecognizeMetadata)MarshalJSON

func (s *LongRunningRecognizeMetadata) MarshalJSON() ([]byte,error)

typeLongRunningRecognizeResponse

type LongRunningRecognizeResponse struct {// Results: Output only. Sequential list of transcription results// corresponding to// sequential portions of audio.Results []*SpeechRecognitionResult `json:"results,omitempty"`// ForceSendFields is a list of field names (e.g. "Results") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Results") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

LongRunningRecognizeResponse: The only message returned to the clientby the `LongRunningRecognize` method.It contains the result as zero or more sequentialSpeechRecognitionResultmessages. It is included in the `result.response` field of the`Operation`returned by the `GetOperation` call of the`google::longrunning::Operations`service.

func (*LongRunningRecognizeResponse)MarshalJSON

func (s *LongRunningRecognizeResponse) MarshalJSON() ([]byte,error)

typeOperation

type Operation struct {// Done: If the value is `false`, it means the operation is still in// progress.// If `true`, the operation is completed, and either `error` or// `response` is// available.Donebool `json:"done,omitempty"`// Error: The error result of the operation in case of failure or// cancellation.Error *Status `json:"error,omitempty"`// Metadata: Service-specific metadata associated with the operation.// It typically// contains progress information and common metadata such as create// time.// Some services might not provide such metadata.  Any method that// returns a// long-running operation should document the metadata type, if any.Metadatagoogleapi.RawMessage `json:"metadata,omitempty"`// Name: The server-assigned name, which is only unique within the same// service that// originally returns it. If you use the default HTTP mapping,// the// `name` should be a resource name ending with// `operations/{unique_id}`.Namestring `json:"name,omitempty"`// Response: The normal response of the operation in case of success.// If the original// method returns no data on success, such as `Delete`, the response// is// `google.protobuf.Empty`.  If the original method is// standard// `Get`/`Create`/`Update`, the response should be the resource.  For// other// methods, the response should have the type `XxxResponse`, where// `Xxx`// is the original method name.  For example, if the original method// name// is `TakeSnapshot()`, the inferred response type// is// `TakeSnapshotResponse`.Responsegoogleapi.RawMessage `json:"response,omitempty"`// ServerResponse contains the HTTP response code and headers from the// server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "Done") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Done") to include in API// requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

Operation: This resource represents a long-running operation that isthe result of anetwork API call.

func (*Operation)MarshalJSON

func (s *Operation) MarshalJSON() ([]byte,error)

typeProjectsLocationsOperationsGetCall

type ProjectsLocationsOperationsGetCall struct {// contains filtered or unexported fields}

func (*ProjectsLocationsOperationsGetCall)Context

Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.

func (*ProjectsLocationsOperationsGetCall)Do

Do executes the "speech.projects.locations.operations.get" call.Exactly one of *Operation or error will be non-nil. Any non-2xxstatus code is an error. Response headers are in either*Operation.ServerResponse.Header or (if a response was returned atall) in error.(*googleapi.Error).Header. Use googleapi.IsNotModifiedto check whether the returned error was becausehttp.StatusNotModified was returned.

func (*ProjectsLocationsOperationsGetCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.

func (*ProjectsLocationsOperationsGetCall)Header

Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.

func (*ProjectsLocationsOperationsGetCall)IfNoneMatch

IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.

typeProjectsLocationsOperationsListCall

type ProjectsLocationsOperationsListCall struct {// contains filtered or unexported fields}

func (*ProjectsLocationsOperationsListCall)Context

Context sets the context to be used in this call's Do method. Anypending HTTP request will be aborted if the provided context iscanceled.

func (*ProjectsLocationsOperationsListCall)Do

Do executes the "speech.projects.locations.operations.list" call.Exactly one of *ListOperationsResponse or error will be non-nil. Anynon-2xx status code is an error. Response headers are in either*ListOperationsResponse.ServerResponse.Header or (if a response wasreturned at all) in error.(*googleapi.Error).Header. Usegoogleapi.IsNotModified to check whether the returned error wasbecause http.StatusNotModified was returned.

func (*ProjectsLocationsOperationsListCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponsefor more information.

func (*ProjectsLocationsOperationsListCall)Filter

Filter sets the optional parameter "filter": The standard listfilter.

func (*ProjectsLocationsOperationsListCall)Header

Header returns an http.Header that can be modified by the caller toadd HTTP headers to the request.

func (*ProjectsLocationsOperationsListCall)IfNoneMatch

IfNoneMatch sets the optional parameter which makes the operationfail if the object's ETag matches the given value. This is useful forgetting updates only after the object has changed since the lastrequest. Use googleapi.IsNotModified to check whether the responseerror from Do is the result of In-None-Match.

func (*ProjectsLocationsOperationsListCall)PageSize

PageSize sets the optional parameter "pageSize": The standard listpage size.

func (*ProjectsLocationsOperationsListCall)PageToken

PageToken sets the optional parameter "pageToken": The standard listpage token.

func (*ProjectsLocationsOperationsListCall)Pages

Pages invokes f for each page of results.A non-nil error returned from f will halt the iteration.The provided context supersedes any context provided to the Context method.

typeProjectsLocationsOperationsService

type ProjectsLocationsOperationsService struct {// contains filtered or unexported fields}

func (*ProjectsLocationsOperationsService)Get

Get: Gets the latest state of a long-running operation. Clients canuse thismethod to poll the operation result at intervals as recommended bythe APIservice.

func (*ProjectsLocationsOperationsService)List

List: Lists operations that match the specified filter in therequest. If theserver doesn't support this method, it returns`UNIMPLEMENTED`.

NOTE: the `name` binding allows API services to override thebindingto use different resource name schemes, such as `users/*/operations`.Tooverride the binding, API services can add a binding suchas"/v1/{name=users/*}/operations" to their service configuration.For backwards compatibility, the default name includes theoperationscollection id, however overriding users must ensure the namebindingis the parent resource, without the operations collection id.

typeProjectsLocationsService

type ProjectsLocationsService struct {Operations *ProjectsLocationsOperationsService// contains filtered or unexported fields}

funcNewProjectsLocationsService

func NewProjectsLocationsService(s *Service) *ProjectsLocationsService

typeProjectsService

type ProjectsService struct {Locations *ProjectsLocationsService// contains filtered or unexported fields}

funcNewProjectsService

func NewProjectsService(s *Service) *ProjectsService

typeService

type Service struct {BasePathstring// API endpoint base URLUserAgentstring// optional additional User-Agent fragmentProjects *ProjectsService// contains filtered or unexported fields}

funcNewdeprecated

func New(client *http.Client) (*Service,error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead.To provide a custom HTTP client, use option.WithHTTPClient.If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

funcNewService

func NewService(ctxcontext.Context, opts ...option.ClientOption) (*Service,error)

NewService creates a new Service.

typeSpeechRecognitionAlternative

type SpeechRecognitionAlternative struct {// Confidence: Output only. The confidence estimate between 0.0 and 1.0.// A higher number// indicates an estimated greater likelihood that the recognized words// are// correct. This field is set only for the top alternative of a// non-streaming// result or, of a streaming result where `is_final=true`.// This field is not guaranteed to be accurate and users should not rely// on it// to be always provided.// The default of 0.0 is a sentinel value indicating `confidence` was// not set.Confidencefloat64 `json:"confidence,omitempty"`// Transcript: Output only. Transcript text representing the words that// the user spoke.Transcriptstring `json:"transcript,omitempty"`// Words: Output only. A list of word-specific information for each// recognized word.// Note: When `enable_speaker_diarization` is true, you will see all the// words// from the beginning of the audio.Words []*WordInfo `json:"words,omitempty"`// ForceSendFields is a list of field names (e.g. "Confidence") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Confidence") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

SpeechRecognitionAlternative: Alternative hypotheses (a.k.a. n-bestlist).

func (*SpeechRecognitionAlternative)MarshalJSON

func (s *SpeechRecognitionAlternative) MarshalJSON() ([]byte,error)

func (*SpeechRecognitionAlternative)UnmarshalJSON

func (s *SpeechRecognitionAlternative) UnmarshalJSON(data []byte)error

typeSpeechRecognitionResult

type SpeechRecognitionResult struct {// Alternatives: Output only. May contain one or more recognition// hypotheses (up to the// maximum specified in `max_alternatives`).// These alternatives are ordered in terms of accuracy, with the top// (first)// alternative being the most probable, as ranked by the recognizer.Alternatives []*SpeechRecognitionAlternative `json:"alternatives,omitempty"`// ChannelTag: Output only. For multi-channel audio, this is the channel// number corresponding to the// recognized result for the audio from that channel.// For `audio_channel_count` = N, its output values can range from `1`// to `N`.ChannelTagint64 `json:"channelTag,omitempty"`// LanguageCode: Output only.// The// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag// of the// language in this result. This language code was detected to have the// most// likelihood of being spoken in the audio.LanguageCodestring `json:"languageCode,omitempty"`// ForceSendFields is a list of field names (e.g. "Alternatives") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Alternatives") to include// in API requests with the JSON null value. By default, fields with// empty values are omitted from API requests. However, any field with// an empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

SpeechRecognitionResult: A speech recognition result corresponding toa portion of the audio.

func (*SpeechRecognitionResult)MarshalJSON

func (s *SpeechRecognitionResult) MarshalJSON() ([]byte,error)

typeStatus

type Status struct {// Code: The status code, which should be an enum value of// google.rpc.Code.Codeint64 `json:"code,omitempty"`// Details: A list of messages that carry the error details.  There is a// common set of// message types for APIs to use.Details []googleapi.RawMessage `json:"details,omitempty"`// Message: A developer-facing error message, which should be in// English. Any// user-facing error message should be localized and sent in// the// google.rpc.Status.details field, or localized by the client.Messagestring `json:"message,omitempty"`// ForceSendFields is a list of field names (e.g. "Code") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Code") to include in API// requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

Status: The `Status` type defines a logical error model that issuitable fordifferent programming environments, including REST APIs and RPC APIs.It isused by [gRPC](https://github.com/grpc). Each `Status` messagecontainsthree pieces of data: error code, error message, and errordetails.

You can find out more about this error model and how to work with itin the[API Design Guide](https://cloud.google.com/apis/design/errors).

func (*Status)MarshalJSON

func (s *Status) MarshalJSON() ([]byte,error)

typeWordInfo

type WordInfo struct {// Confidence: Output only. The confidence estimate between 0.0 and 1.0.// A higher number// indicates an estimated greater likelihood that the recognized words// are// correct. This field is set only for the top alternative of a// non-streaming// result or, of a streaming result where `is_final=true`.// This field is not guaranteed to be accurate and users should not rely// on it// to be always provided.// The default of 0.0 is a sentinel value indicating `confidence` was// not set.Confidencefloat64 `json:"confidence,omitempty"`// EndOffset: Output only. Time offset relative to the beginning of the// audio,// and corresponding to the end of the spoken word.// This field is only set if `enable_word_time_offsets=true` and only// in the top hypothesis.// This is an experimental feature and the accuracy of the time offset// can// vary.EndOffsetstring `json:"endOffset,omitempty"`// SpeakerTag: Output only. A distinct integer value is assigned for// every speaker within// the audio. This field specifies which one of those speakers was// detected to// have spoken this word. Value ranges from `1`// to// `diarization_speaker_count`. speaker_tag is set// if// `enable_speaker_diarization` = `true` and only in the top// alternative.SpeakerTagint64 `json:"speakerTag,omitempty"`// StartOffset: Output only. Time offset relative to the beginning of// the audio,// and corresponding to the start of the spoken word.// This field is only set if `enable_word_time_offsets=true` and only// in the top hypothesis.// This is an experimental feature and the accuracy of the time offset// can// vary.StartOffsetstring `json:"startOffset,omitempty"`// Word: Output only. The word corresponding to this set of information.Wordstring `json:"word,omitempty"`// ForceSendFields is a list of field names (e.g. "Confidence") to// unconditionally include in API requests. By default, fields with// empty values are omitted from API requests. However, any non-pointer,// non-interface field appearing in ForceSendFields will be sent to the// server regardless of whether the field is empty or not. This may be// used to include empty fields in Patch requests.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Confidence") to include in// API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. However, any field with an// empty value appearing in NullFields will be sent to the server as// null. It is an error if a field in this list has a non-empty value.// This may be used to include null fields in Patch requests.NullFields []string `json:"-"`}

WordInfo: Word-specific information for recognized words.

func (*WordInfo)MarshalJSON

func (s *WordInfo) MarshalJSON() ([]byte,error)

func (*WordInfo)UnmarshalJSON

func (s *WordInfo) UnmarshalJSON(data []byte)error

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp