Split single Voxtral transcript segments
This commit is contained in:
@@ -135,6 +135,30 @@ func TestSegmentTranscriptTextAddsHeuristicSpeakers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeAudioLLMSegmentsSplitsSingleLongSegment(t *testing.T) {
|
||||
text := "Алло, добрый день. Да, слушаю. Скажите, квартира продается? Да, продается."
|
||||
got := normalizeAudioLLMSegments([]Segment{{Start: 0, End: 12, Text: text}}, text, true)
|
||||
if len(got) < 2 {
|
||||
t.Fatalf("segments = %#v, want heuristic split", got)
|
||||
}
|
||||
if got[0].Speaker != "SPEAKER_00" || got[1].Speaker != "SPEAKER_01" {
|
||||
t.Fatalf("speakers = %q/%q", got[0].Speaker, got[1].Speaker)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNormalizeAudioLLMSegmentsKeepsSegmentsAndAddsSpeakers(t *testing.T) {
|
||||
got := normalizeAudioLLMSegments([]Segment{
|
||||
{Start: 0, End: 1, Text: "Алло."},
|
||||
{Start: 1, End: 2, Text: "Да, слушаю."},
|
||||
}, "Алло. Да, слушаю.", true)
|
||||
if len(got) != 2 {
|
||||
t.Fatalf("segments = %#v", got)
|
||||
}
|
||||
if got[0].Speaker != "SPEAKER_00" || got[1].Speaker != "SPEAKER_01" {
|
||||
t.Fatalf("speakers = %q/%q", got[0].Speaker, got[1].Speaker)
|
||||
}
|
||||
}
|
||||
|
||||
func near(got, want float64) bool {
|
||||
return math.Abs(got-want) < 0.000001
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user