Documentation
¶
Overview ¶
Package crosslang implements cross-language subtitle alignment using anchor-based matching and dynamic programming.
Index ¶
- Constants
- func CountCognates(a, b []string) int
- func CountShared(a, b []string) int
- func CountSharedFold(a, b []string) int
- func EditDistance(a, b string) int
- func IsCognate(a, b string) bool
- func IsLatinWord(s string) bool
- func WeightedMedianOffset(pairs []CuePair) int64
- type Anchor
- type Cue
- type CuePair
- type Result
Constants ¶
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 ¶
func CountCognates ¶
CountCognates counts cognate pairs between two word lists.
func CountShared ¶
CountShared counts exact string matches between two slices.
func CountSharedFold ¶
CountSharedFold counts case-insensitive matches between two slices.
func EditDistance ¶
EditDistance computes the Levenshtein distance between two strings.
func IsLatinWord ¶
IsLatinWord returns true if the string contains only Latin letters.
func WeightedMedianOffset ¶
WeightedMedianOffset computes the weighted median offset from pairs.
Types ¶
type Anchor ¶
type Anchor struct {
Punctuation string
Numbers []string
ProperNouns []string
Cognates []string
WordCount int
CharLen int
}
Anchor represents language-independent features extracted from a subtitle cue.
func ExtractAnchors ¶
ExtractAnchors extracts language-independent features from cue text.
type Cue ¶
Cue represents a single subtitle cue with timing and text. Structurally identical to subsync.Cue to allow zero-copy conversion.
type CuePair ¶
CuePair holds a matched pair of cues with their similarity score. Exported for test compatibility with the parent subsync package.