Bugfixes and documentation cleanup for v1.0 release.
All checks were successful
ci/woodpecker/tag/release Pipeline was successful

This commit is contained in:
2026-05-01 11:30:29 -05:00
parent c9e98e14b5
commit f20f06db12
17 changed files with 332 additions and 177 deletions

View File

@@ -13,22 +13,23 @@ import (
const (
DefaultInputReader = "json-files"
DefaultOutputModules = "json"
DefaultOutputSchema = OutputSchemaDefault
DefaultOutputSchema = OutputSchemaIntermediate
DefaultPreprocessingModules = "validate-raw,normalize-speakers,trim-text"
DefaultPostprocessingModules = "detect-overlaps,resolve-overlaps,backchannel,filler,resolve-danglers,coalesce,detect-overlaps,autocorrect,assign-ids,validate-output"
DefaultOverlapWordRunGap = 0.75
DefaultOverlapWordRunGap = 1.0
DefaultWordRunReorderWindow = 1.0
DefaultCoalesceGap = 3.0
DefaultCoalesceGapValue = "3.0"
DefaultBackchannelMaxDuration = 2.0
DefaultFillerMaxDuration = 1.25
OutputSchemaEnv = "SERIATIM_OUTPUT_SCHEMA"
OverlapWordRunGapEnv = "SERIATIM_OVERLAP_WORD_RUN_GAP"
WordRunReorderWindowEnv = "SERIATIM_OVERLAP_WORD_RUN_REORDER_WINDOW"
BackchannelMaxDurationEnv = "SERIATIM_BACKCHANNEL_MAX_DURATION"
FillerMaxDurationEnv = "SERIATIM_FILLER_MAX_DURATION"
OutputSchemaDefault = "default"
OutputSchemaSeriatim = "seriatim"
OutputSchemaMinimal = "minimal"
OutputSchemaMinimal = "seriatim-minimal"
OutputSchemaIntermediate = "seriatim-intermediate"
OutputSchemaFull = "seriatim-full"
)
// MergeOptions captures raw CLI option values before validation.
@@ -70,7 +71,7 @@ func NewMergeConfig(opts MergeOptions) (Config, error) {
cfg := Config{
InputReader: strings.TrimSpace(opts.InputReader),
OutputModules: nil,
OutputSchema: strings.TrimSpace(opts.OutputSchema),
OutputSchema: "",
PreprocessingModules: nil,
PostprocessingModules: nil,
OverlapWordRunGap: DefaultOverlapWordRunGap,
@@ -83,14 +84,12 @@ func NewMergeConfig(opts MergeOptions) (Config, error) {
if cfg.InputReader == "" {
return Config{}, errors.New("--input-reader is required")
}
if cfg.OutputSchema == "" {
cfg.OutputSchema = DefaultOutputSchema
}
if err := validateOutputSchema(cfg.OutputSchema); err != nil {
var err error
cfg.OutputSchema, err = resolveOutputSchema(opts.OutputSchema)
if err != nil {
return Config{}, err
}
var err error
cfg.OutputModules, err = parseModuleList(opts.OutputModules)
if err != nil {
return Config{}, fmt.Errorf("--output-modules: %w", err)
@@ -189,13 +188,27 @@ func parseModuleList(value string) ([]string, error) {
func validateOutputSchema(value string) error {
switch value {
case OutputSchemaDefault, OutputSchemaSeriatim, OutputSchemaMinimal:
case OutputSchemaMinimal, OutputSchemaIntermediate, OutputSchemaFull:
return nil
default:
return fmt.Errorf("--output-schema must be one of %q, %q, or %q", OutputSchemaDefault, OutputSchemaMinimal, OutputSchemaSeriatim)
return fmt.Errorf("--output-schema must be one of %q, %q, or %q", OutputSchemaMinimal, OutputSchemaIntermediate, OutputSchemaFull)
}
}
func resolveOutputSchema(value string) (string, error) {
value = strings.TrimSpace(value)
if value == "" {
value = strings.TrimSpace(os.Getenv(OutputSchemaEnv))
}
if value == "" {
value = DefaultOutputSchema
}
if err := validateOutputSchema(value); err != nil {
return "", err
}
return value, nil
}
func normalizeInputFiles(paths []string) ([]string, error) {
if len(paths) == 0 {
return nil, errors.New("at least one --input-file is required")