34 lines
701 B
Go
34 lines
701 B
Go
package output
|
|
|
|
import (
|
|
"transcribe/internal/whisper"
|
|
)
|
|
|
|
// Formatter interface for converting transcription results to various output formats
|
|
type Formatter interface {
|
|
Format(result *whisper.TranscriptionResult) (string, error)
|
|
}
|
|
|
|
// FormatType represents the output format type
|
|
type FormatType string
|
|
|
|
const (
|
|
FormatText FormatType = "text"
|
|
FormatSRT FormatType = "srt"
|
|
FormatJSON FormatType = "json"
|
|
)
|
|
|
|
// NewFormatter creates a formatter for the given format type
|
|
func NewFormatter(format FormatType) Formatter {
|
|
switch format {
|
|
case FormatSRT:
|
|
return &SRTFormatter{}
|
|
case FormatJSON:
|
|
return &JSONFormatter{}
|
|
case FormatText:
|
|
fallthrough
|
|
default:
|
|
return &TextFormatter{}
|
|
}
|
|
}
|