generic

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AudioPadSec = 0.20

AudioPadSec is the context, in seconds, added on each side of the speech of every training and ASR sample, whether a verse or a phrase. It is limited to half the gap to the neighbouring sample in the same audio file, so that neighbouring samples never overlap. Verses and phrases use the same padding so that a model trained on phrases hears the same lead-in and tail-off as the verses that ASR is run on.

Variables

This section is empty.

Functions

func OutputAudioFiles added in v1.2.0

func OutputAudioFiles(ctx context.Context, files map[string]AudioFile) (string, *log.Status)

func PadBegin added in v1.2.0

func PadBegin(beginTS float64, prevEndTS float64, hasPrev bool) float64

PadBegin returns the padded start of a sample whose speech starts at beginTS, when the previous sample's speech ends at prevEndTS. hasPrev is false at the start of an audio file.

func PadEnd added in v1.2.0

func PadEnd(endTS float64, nextBeginTS float64, hasNext bool) float64

PadEnd returns the padded end of a sample whose speech ends at endTS, when the next sample's speech starts at nextBeginTS. hasNext is false at the end of an audio file.

Types

type AlignChar

type AlignChar struct {
	LineId      int64
	LineRef     VerseRef // e.g. GEN 1:3-5a or GEN 1 or GEN 1:49-2:1
	WordId      int64    // WordSeq, Word could be added
	Word        string
	WordPunct   string
	CharSeq     int
	Char        rune
	BeginTS     float64
	EndTS       float64
	FAScore     float64
	IsASR       bool
	Duration    float64
	Silence     float64
	SilencePos  int
	ScoreError  int
	SilenceLong int
}

type AlignLine

type AlignLine struct {
	Chars []AlignChar
}

type AudioFile added in v1.2.0

type AudioFile struct {
	BookId      string `json:"book_id"`
	Chapter     int    `json:"chapter"`
	Bucket      string `json:"bucket"`
	ObjectKey   string `json:"object_key"`
	UnsignedURL string `json:"unsigned_url"`
	SignedURL   string `json:"signed_url"`
}

func NewAudioFile added in v1.2.0

func NewAudioFile(bookId string, chapter int, baseURL string, filename string) AudioFile

type Char

type Char struct {
	CharId int64
	WordId int64
	Seq    int
	Uroman rune
	Start  float64
	End    float64
	Score  float64
}

type Char2 added in v1.2.0

type Char2 struct {
	Char        rune    `json:"char"`
	BeginTS     float64 `json:"begin_ts"` // Used in align_silence to compute silence
	EndTS       float64 `json:"end_ts"`   // Used in align_silence to compute silence
	FAScore     float64 `json:"fa_score"` // The critical output from qa_align used to locate errors
	Silence     float64 `json:"-"`        // Computed in align_silence
	SilenceLong int     `json:"-"`
	IsASR       bool    `json:"-"`
}

Char2 is sourced from chars_qa_align, words_qa_align, and scripts_qa_align, the result of forced alignment using a model for the language, not MMS. qa_align adds each verse's chop offset (qa_align.go's FARequest.BeginTS) onto its timestamps before storing them, so they are chapter-absolute, the same frame as the timestamps in the other tables.

type InputFile added in v1.2.0

type InputFile struct {
	MediaId    string
	MediaType  request.MediaType
	Testament  string
	BookId     string // not used for text_plain
	BookSeq    string
	Chapter    int // only used for audio
	ChapterEnd int
	Verse      string // not sure how this is used but parseV4AudioFilename parses it.
	VerseEnd   string
	ScriptLine string
	Filename   string
	FileExt    string
	Directory  string
	BaseURL    string
}

func (*InputFile) FilePath added in v1.2.0

func (i *InputFile) FilePath() string

type LogicalKey

type LogicalKey interface {
	IsLogicalKey()
	UniqueKey() string
	Description() string
}

type Pair added in v1.2.0

type Pair struct {
	Ref       VerseRef `json:"ref"`
	ScriptNum string   `json:"script_num"`
	AudioFile string   `json:"audio_file"`
	BeginTS   float64  `json:"begin_ts"`
	EndTS     float64  `json:"end_ts"`
	Base      PairText `json:"base"`
	Comp      PairText `json:"comp"`
	Text      PairDiff `json:"text"`
	Uroman    PairDiff `json:"uroman"`
}

func (*Pair) Deletes added in v1.2.0

func (p *Pair) Deletes() int

func (*Pair) ErrorPct added in v1.2.0

func (p *Pair) ErrorPct(inserts int, deletes int) float64

func (*Pair) Inserts added in v1.2.0

func (p *Pair) Inserts() int

func (*Pair) LargestLength added in v1.2.0

func (p *Pair) LargestLength() int

LargestLength returns the longest run of contiguous non-equal chars: inserts, deletes and replaces next to each other, ended by any equal text. Spaces are not counted. A replace contributes the longer of its two sides.

func (*Pair) LargestLengthTest added in v1.2.0

func (p *Pair) LargestLengthTest() int

LargestLengthTest returns the longest run of inserted/deleted chars. A single equal char between changes does not break the run, and is not counted.

type PairDiff added in v1.2.0

type PairDiff struct {
	Diffs []diff.Diff `json:"diffs"`
	HTML  string      `json:"html"`
}

type PairText added in v1.2.0

type PairText struct {
	ScriptId int64  `json:"script_id"`
	Text     string `json:"text"`
	Uroman   string `json:"uroman"`
}

type Publish

type Publish struct {
	BookId     string
	ChapterNum int
	Page       int
	Paragraph  int
	Sentence   int
	// contains filtered or unexported fields
}

func NewPublish

func NewPublish(key string) Publish

func (Publish) Description

func (p Publish) Description() string

func (Publish) IsLogicalKey

func (p Publish) IsLogicalKey()

func (Publish) UniqueKey

func (p Publish) UniqueKey() string

type Verse2 added in v1.2.0

type Verse2 struct {
	ScriptId    int64    `json:"script_id"`
	LineRef     VerseRef `json:"verse_ref"`
	ASRText     string   `json:"asr_transcript"` // Transcript
	BeginTS     float64  `json:"begin_ts"`       // Start of the audio given to ASR and qa_align
	EndTS       float64  `json:"end_ts"`         // End of the audio given to ASR and qa_align
	PlayBeginTS float64  `json:"play_begin_ts"`  // Used in report to play audio, see scripts.play_begin_ts
	PlayEndTS   float64  `json:"play_end_ts"`    // Used in report to play audio
	Duration    float64  `json:"duration"`       // Displayed in audio
	Words       []Word2  `json:"words"`
}

func (Verse2) PlayTimes added in v1.2.0

func (v Verse2) PlayTimes() (float64, float64)

PlayTimes returns the audio a report plays for this verse. A database aligned before the play times existed has none, and then plays the verse's ASR audio.

func (Verse2) Text added in v1.2.0

func (v Verse2) Text() string

Text returns the verse's words joined by spaces, lowercased.

func (Verse2) ToPair added in v1.2.0

func (v Verse2) ToPair() Pair

ToPair builds a Pair whose Base is this verse's lowercased word text and whose Comp is compText, attributed to compScriptId.

func (Verse2) Uroman added in v1.2.0

func (v Verse2) Uroman() string

type VerseRef

type VerseRef struct {
	BookId     string `json:"book_id"`
	ChapterNum int    `json:"chapter_num"`
	VerseStr   string `json:"verse_str"`
	ChapterEnd int    `json:"chapter_end"`
	VerseEnd   string `json:"verse_end"`
}

func NewVerseRef

func NewVerseRef(key string) VerseRef

func (VerseRef) Description

func (r VerseRef) Description() string

func (VerseRef) IsLogicalKey

func (r VerseRef) IsLogicalKey()

func (VerseRef) UniqueKey

func (r VerseRef) UniqueKey() string

type Word2 added in v1.2.0

type Word2 struct {
	WordId    int64   `json:"word_id"`
	Chars     []Char2 `json:"chars"`
	Text      string  `json:"word"`       // Word text with no punctuation
	WordPunct string  `json:"word_punct"` // Word with punctuation added back
	Uroman    string  `json:"uroman"`
	BeginTS   float64 `json:"begin_ts"` // Used in report for word Karoke highlighting
	EndTS     float64 `json:"end_ts"`   // Used in report for word Karoke highlighting
	FAScore   float64 `json:"fa_score"` // Computed in align_compare
	IsASR     bool    `json:"-"`
	Opacity   float64 `json:"-"`
}

Jump to

Keyboard shortcuts

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