20 lines
418 B
Go
20 lines
418 B
Go
package output
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"transcribe/internal/whisper"
|
|
)
|
|
|
|
// JSONFormatter formats transcription results as JSON
|
|
type JSONFormatter struct{}
|
|
|
|
// Format converts transcription result to JSON format
|
|
func (f *JSONFormatter) Format(result *whisper.TranscriptionResult) (string, error) {
|
|
data, err := json.MarshalIndent(result, "", " ")
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return string(data), nil
|
|
}
|