gorec

package module
v0.0.0-...-d6088b8 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2015 License: MIT Imports: 10 Imported by: 0

README

gorec

Experimental Go ASR using Google speech API

Documentation

Index

Constants

View Source
const (
	GoogleEndpoint = "https://www.google.com/speech-api/v2/recognize?lang=%s&output=json&key=%s"
	ContentType    = "audio/l16; rate=16000;"
)

Variables

View Source
var SupportedLanguages = []Language{
	English,
	Spanish,
	French,
	Greek,
	German,
	Italian,
}

Functions

func ReadAudioFile

func ReadAudioFile(path string) ([]byte, error)

Types

type Alternative

type Alternative struct {
	Transcript string  `json:"transcript"`
	Confidence float64 `json:"confidence"`
}

type GoogleResponse

type GoogleResponse struct {
	Results     []Result `json:"result"`
	ResultIndex int      `json:"result_index"`
}

type Hypothesis

type Hypothesis struct {
	Alternative Alternative `json:"text"`
	Language    Language    `json:"language"`
	Err         error       `json:-`
}

func ListenFile

func ListenFile(audio []byte, key string) (*Hypothesis, error)

func (Hypothesis) String

func (h Hypothesis) String() string

type Language

type Language int
const (
	English Language = iota
	Spanish
	French
	Greek
	German
	Italian
)

func (Language) MarshalJSON

func (l Language) MarshalJSON() ([]byte, error)

func (Language) String

func (l Language) String() string

func (Language) StringCode

func (l Language) StringCode() string

type Result

type Result struct {
	Alternatives []Alternative `json:"alternative"`
	Final        bool          `json:"final"`
}

Jump to

Keyboard shortcuts

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