Add trim CLI command

This commit is contained in:
2026-05-08 14:53:59 +00:00
parent 1c0e4438ae
commit ac3dcf2557
7 changed files with 996 additions and 1 deletions

View File

@@ -95,6 +95,9 @@ func Apply(input schema.Transcript, opts Options) (Result, error) {
}
kept, groups := recomputeOverlapGroups(kept)
if groups == nil {
groups = make([]schema.OverlapGroup, 0)
}
out := copyTranscript(input)
out.Segments = kept
@@ -278,7 +281,7 @@ func validateSelectedIDsExist(selected []int, idIndex map[int]int) error {
func recomputeOverlapGroups(segments []schema.Segment) ([]schema.Segment, []schema.OverlapGroup) {
if len(segments) == 0 {
return segments, nil
return segments, make([]schema.OverlapGroup, 0)
}
modelSegments := make([]model.Segment, len(segments))