Documentation
¶
Overview ¶
Output formatters for transcript text.
Package render turns transcript segments into agent-sized text with structural truncation metadata. Truncation state is reported in the header and in structured metadata, never only in a trailing footer (clients cut the tail first).
Index ¶
Constants ¶
const ( // BlockSeconds is the granularity=block window, also reported as the // timestamp precision in structured metadata. BlockSeconds = 30.0 )
Variables ¶
This section is empty.
Functions ¶
func FormatSRT ¶
func FormatSRT(t *transcript.Transcript) string
FormatSRT renders a transcript as SubRip subtitles.
func Select ¶
func Select(segs []transcript.Segment, opts Options) []transcript.Segment
Select returns the raw segments in the requested range. It is used by SRT output, where the rendered text blocks are not wanted.
Types ¶
type JSONSelection ¶
type JSONSelection struct {
Segments []transcript.Segment
ReturnedCues int
ReturnedWords int
TotalChars int
ReturnedChars int
Truncated bool
NextStartSeconds *float64
NextCueIndex *int
Coverage string
}
JSONSelection is the cue-level counterpart of Rendered: the same selection and char budget, but expressed as raw segments so meta and payload agree.
func SelectForJSON ¶
func SelectForJSON(segs []transcript.Segment, durationSeconds int, opts Options) JSONSelection
SelectForJSON returns the cue-level counterpart of Render.
type Options ¶
type Options struct {
Granularity string // cue | block
TimestampMode string // none | block | cue
StartSeconds float64 // 0 = from beginning
EndSeconds float64 // 0 = to end
StartCue int
MaxCues int
MaxChars int // 0 = unlimited; bounds the body only
Bare bool // text only: omit the metadata header and truncation trailer
}
Options control range selection and rendering.
type Rendered ¶
type Rendered struct {
Text string
Granularity string
TimestampMode string
Notes []string
TotalCues int
ReturnedCues int
TotalChars int // runes, whole transcript
ReturnedChars int // runes, returned body only
Words int // whole transcript
ReturnedWords int
StartSeconds float64
EndSeconds float64
Truncated bool
NextStartSeconds *float64
NextCueIndex *int
Coverage string
}
Rendered is the text rendering plus its truncation metadata.
func Render ¶
func Render(t *transcript.Transcript, durationSeconds int, opts Options) Rendered
Render renders a transcript as text.