crosslang

package
v0.9.0-dev.16 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package crosslang implements cross-language subtitle alignment using anchor-based matching and dynamic programming.

Index

Constants

View Source
const MinCuesForSync = 5

MinCuesForSync is the minimum number of cues required for alignment. Must match subsync.MinCuesForSync — kept as a const here to avoid a circular import between subsync and crosslang.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cue

type Cue struct {
	Text  string
	Start time.Duration
	End   time.Duration
}

Cue represents a single subtitle cue with timing and text. Structurally identical to subsync.Cue to allow zero-copy conversion.

type Result

type Result struct {
	Cues       []Cue
	Offset     int64   // milliseconds
	Rate       float64 // always 1.0 for crosslang
	Confidence float64
}

Result holds the output of cross-language alignment.

func Align

func Align(ctx context.Context, reference, incorrect []Cue) Result

Align finds the best constant offset between reference and incorrect subtitles using cross-language anchor matching.

Jump to

Keyboard shortcuts

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