decoder

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeamPQ

type BeamPQ []*Hypothesis

Define beam priority queue methods (for heap interface)

func (BeamPQ) Len

func (pq BeamPQ) Len() int

func (BeamPQ) Less

func (pq BeamPQ) Less(i, j int) bool

func (*BeamPQ) Pop

func (pq *BeamPQ) Pop() interface{}

func (*BeamPQ) Push

func (pq *BeamPQ) Push(x interface{})

func (BeamPQ) Swap

func (pq BeamPQ) Swap(i, j int)

type ExpectedMatchingBeamDecoder

type ExpectedMatchingBeamDecoder struct {
	// Expected sequence of words/tokens
	ExpectedSequence []int

	// Vocabulary size of model
	VocabSize int

	// Size of beam
	BeamWidth int

	// CTC blank token ID
	BlankID int

	// Weights for scoring
	ExpectedMatchBonus float64 // Bonus for matching expected token
	InsertionPenalty   float64 // Penalty for inserting a token not in expected sequence
	DeletionPenalty    float64 // Penalty for skipping an expected token

	// Maximum lookahead in expected sequence
	MaxLookahead int
}

ExpectedMatchingBeamDecoder implements a beam search decoder with expected matching

func (*ExpectedMatchingBeamDecoder) Decode

func (d *ExpectedMatchingBeamDecoder) Decode(logProbs [][]float64) []int

Decode performs beam search decoding on acoustic model probabilities

type Hypothesis

type Hypothesis struct {
	// Sequence of tokens/words decoded so far
	Tokens []int

	// Position in the expected output sequence
	ExpectedPos int

	// Cumulative log probability score
	Score float64

	// Position in acoustic frames
	TimeStep int
	// contains filtered or unexported fields
}

Hypothesis represents a partial decoding hypothesis

Jump to

Keyboard shortcuts

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