Documentation ¶
Overview ¶
Package transcription implements functions for the manipulation and transcription of audio files.
TODO(sandlerben): This package should be refactored into several more files.
Index ¶
- func ConvertAudioIntoFormat(filePath, fileExt string) (string, error)
- func DownloadFileFromURL(url string) (string, error)
- func MakeIBMTaskFunction(audioURL string, emailAddresses []string, searchWords []string) (task func(string) error, onFailure func(string, string))
- func SendEmail(username string, password string, host string, port int, to []string, ...) error
- func SplitWavFile(wavFilePath string) ([]string, error)
- func UploadFileToBackblaze(filePath string, accountID string, applicationKey string, bucketName string) (string, error)
- func WriteToMongo(data *Transcription, url string) error
- type IBMResult
- type Transcription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAudioIntoFormat ¶
ConvertAudioIntoFormat converts encoded audio into the required format.
func DownloadFileFromURL ¶
DownloadFileFromURL locally downloads an audio file stored at url.
func MakeIBMTaskFunction ¶
func MakeIBMTaskFunction(audioURL string, emailAddresses []string, searchWords []string) (task func(string) error, onFailure func(string, string))
MakeIBMTaskFunction returns a task function for transcription using IBM transcription functions. TODO(#52): Quite a lot of the transcription process could be done concurrently.
func SendEmail ¶
func SendEmail(username string, password string, host string, port int, to []string, subject string, body string) error
SendEmail connects to an email server at host:port and sends an email from address from, to address to, with subject line subject with message body.
func SplitWavFile ¶
SplitWavFile ensures that the input audio files to IBM are less than 100mb, with 5 seconds of redundancy between files.
func UploadFileToBackblaze ¶
func UploadFileToBackblaze(filePath string, accountID string, applicationKey string, bucketName string) (string, error)
UploadFileToBackblaze uploads the given gile to the given backblaze bucket
func WriteToMongo ¶
func WriteToMongo(data *Transcription, url string) error
WriteToMongo takes a string and writes it to the database
Types ¶
type IBMResult ¶
type IBMResult struct { ResultIndex int `json:"result_index"` Results []ibmResultField `json:"results"` }
IBMResult is the result of an IBM transcription. See https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/speech-to-text/output.shtml for details.
type Transcription ¶
type Transcription struct { Transcript string AudioURL string CompletedAt time.Time Timestamps []timestamp Confidences []confidence Keywords []ibmKeywordResult }
Transcription contains the full transcription and other information.
func GetTranscription ¶
func GetTranscription(results []*IBMResult) *Transcription
GetTranscription gets the full transcript from an IBMResult.