You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
729 B
36 lines
729 B
package whisper
|
|
|
|
import (
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
// TYPES
|
|
|
|
// Model is the interface to a whisper model. Create a new model with the
|
|
// function whisper.New(string)
|
|
type Model interface {
|
|
io.Closer
|
|
|
|
NewContext() (Context, error)
|
|
}
|
|
|
|
// Context is the speach recognition context.
|
|
type Context interface {
|
|
// Process mono audio data and return any errors.
|
|
Process([]float32) error
|
|
|
|
// Return segments until the end of the stream is reached, when io.EOF is
|
|
// returned.
|
|
NextSegment() (Segment, error)
|
|
}
|
|
|
|
type Segment struct {
|
|
// Time beginning and end timestamps for the segment.
|
|
Start, End time.Duration
|
|
|
|
// The text of the segment.
|
|
Text string
|
|
}
|