fa

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: 2 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

Overview

Package fa derives word-level forced-alignment scores from per-character rows, using true durations recovered from the inter-character Silence (which restores the timing that CTC's peaky, one-frame-per-character spikes otherwise hide).

The primary error detector is the MINIMUM character score (empirically the strongest single signal): an alignment error collapses at least one character toward zero, while a merely-hard-but-correct word stays uniformly mediocre. TrimmedMinScore drops leading/trailing characters that look like spillover contamination from an adjacent word before taking the minimum.

Index

Constants

View Source
const SilInWord = 3

SilInWord marks an intra-word gap: part of the character's real duration.

Variables

This section is empty.

Functions

func GeometricMean

func GeometricMean(scores []float64) float64

GeometricMean is exp(mean(log(score))), the FA score of a word from its chars, and of a verse from its words, in both mms_align and qa_align. A score of 0 is taken as 1e-12. It returns 0 when there are no scores.

Types

type FAChar

type FAChar struct {
	Char        rune
	BeginTS     float64
	EndTS       float64
	FAScore     float64
	Silence     float64
	SilenceLong int
	IsASR       bool // reserved; not used yet
}

FAChar mirrors your Char2, so filling it is a field-for-field copy.

type FAConfig

type FAConfig struct {
	StrongScore      float64
	RampDropFrac     float64
	MaxLeadingFrac   float64
	MinRampChars     int
	RequireShortLead bool
	LeadShortDurSec  float64
}

FAConfig holds tunable thresholds for edge-contamination detection.

func DefaultFAConfig

func DefaultFAConfig() FAConfig

type WordFA

type WordFA struct {
	MinScore        float64 // primary detector
	TrimmedMinScore float64 // min after dropping contaminated edge chars
}

WordFA is the score vector for one word.

func ComputeWordFA

func ComputeWordFA(chars []FAChar, cfg FAConfig) WordFA

ComputeWordFA computes MinScore and TrimmedMinScore for one word from its character rows.

Jump to

Keyboard shortcuts

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