interfaces

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 0 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// message types
	TypeMessageResponse  string = "Results"
	TypeMetadataResponse string = "Metadata"

	// Error type
	TypeErrorResponse string = "Error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alternative

type Alternative struct {
	Confidence float64 `json:"confidence,omitempty"`
	Transcript string  `json:"transcript,omitempty"`
	Words      []Word  `json:"words,omitempty"`
}

Alternative is a single alternative in a transcript

type Channel

type Channel struct {
	Alternatives []Alternative `json:"alternatives,omitempty"`
}

Channel is a single channel in a transcript

type ErrorResponse

type ErrorResponse struct {
	Description string `json:"description"`
	Message     string `json:"message"`
	Type        string `json:"type"`
	Variant     string `json:"variant"`
}

ErrorResponse is the response from a live transcription

type LiveMessageCallback

type LiveMessageCallback interface {
	Message(mr *MessageResponse) error
	Metadata(md *MetadataResponse) error
	Error(er *ErrorResponse) error
}

LiveMessageCallback is a callback used to receive notifcations for platforms messages

type MessageResponse

type MessageResponse struct {
	Channel      Channel  `json:"channel,omitempty"`
	ChannelIndex []int    `json:"channel_index,omitempty"`
	Duration     float64  `json:"duration,omitempty"`
	IsFinal      bool     `json:"is_final,omitempty"`
	Metadata     Metadata `json:"metadata,omitempty"`
	SpeechFinal  bool     `json:"speech_final,omitempty"`
	Start        float64  `json:"start,omitempty"`
	Type         string   `json:"type,omitempty"`
}

********************************* Results from Live Transcription ********************************* MessageResponse is the response from a live transcription

type Metadata

type Metadata struct {
	ModelInfo ModelInfo `json:"model_info,omitempty"`
	ModelUUID string    `json:"model_uuid,omitempty"`
	RequestID string    `json:"request_id,omitempty"`
}

Metadata is the metadata for a transcript

type MetadataResponse

type MetadataResponse struct {
	Channels       int                  `json:"channels,omitempty"`
	Created        string               `json:"created,omitempty"`
	Duration       float64              `json:"duration,omitempty"`
	ModelInfo      map[string]ModelInfo `json:"model_info,omitempty"`
	Models         []string             `json:"models,omitempty"`
	RequestID      string               `json:"request_id,omitempty"`
	Sha256         string               `json:"sha256,omitempty"`
	TransactionKey string               `json:"transaction_key,omitempty"`
	Type           string               `json:"type,omitempty"`
}

MetadataResponse is the response from a live transcription

type ModelInfo

type ModelInfo struct {
	Arch    string `json:"arch,omitempty"`
	Name    string `json:"name,omitempty"`
	Version string `json:"version,omitempty"`
}

ModelInfo is the model information for a transcript

type Word

type Word struct {
	Confidence     float64 `json:"confidence,omitempty"`
	End            float64 `json:"end,omitempty"`
	PunctuatedWord string  `json:"punctuated_word,omitempty"`
	Start          float64 `json:"start,omitempty"`
	Word           string  `json:"word,omitempty"`
}

********************************* shared/common structs ********************************* Word is a single word in a transcript

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL