transcribe

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Line

type Line struct {
	Nickname string
	Words    []Word
}

Line is a line of spoken text by a singular speaker.

func LinesFromFile

func LinesFromFile(file string) ([]Line, error)

LinesFromFile can be used to read all transcription lines from an input file. The Word.StartTime will just be arbitrarily increased by 0.2 for each word.

func ToLines

func ToLines(words []Word) []Line

ToLines converts all of the given words to lines of text. A line of text will always be spoken by one speaker, so if speakers switch there will be a new line. There will also be a new line if no speaker is speaking for more than 5 seconds.

func (*Line) String

func (l *Line) String() string

func (*Line) WordsString

func (l *Line) WordsString() string

WordsString returns all words joined by a space.

type WhisperxResult

type WhisperxResult struct {
	Segments []struct {
		Start float64 `json:"start"`
		End   float64 `json:"end"`
		Text  string  `json:"text"`
		Words []struct {
			Word  string  `json:"word"`
			Start float64 `json:"start"`
			End   float64 `json:"end"`
			Score float64 `json:"score"`
		} `json:"words"`
	} `json:"segments"`
	WordSegments []struct {
		Word  string  `json:"word"`
		Start float64 `json:"start"`
		End   float64 `json:"end"`
		Score float64 `json:"score"`
	} `json:"word_segments"`
}

type Word

type Word struct {
	// Nickname of the speaker.
	Nickname string
	// Text that was spoken including puctuation.
	Text string
	// StartTime relative to the beginning of the recording in second floating-point precision.
	StartTime float64
}

Word is a singular transcribed word.

func AsWords

func AsWords(dir, language, model string, fileExtensions []string) ([]Word, error)

AsWords will transcribe all audio files in the given directory that match the fileExtensions.

The language and model will just be passed as-is to WhisperX.

func (*Word) String

func (w *Word) String() string

Jump to

Keyboard shortcuts

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