55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
package seriatim
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"gitea.maximumdirect.net/eric/notarius/internal/core/source"
|
|
"gitea.maximumdirect.net/eric/notarius/internal/framework/contracts"
|
|
"gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline"
|
|
)
|
|
|
|
const Key = "seriatim"
|
|
|
|
const (
|
|
DocumentKind = "transcript"
|
|
UnitKind = "transcript_segment"
|
|
Format = "application/vnd.seriatim.minimal+json"
|
|
)
|
|
|
|
var providedCapabilities = []string{
|
|
"source.transcript",
|
|
"transcript.speaker",
|
|
"transcript.timestamps",
|
|
}
|
|
|
|
var _ contracts.InputAdapter = (*Adapter)(nil)
|
|
|
|
type Adapter struct{}
|
|
|
|
func New() *Adapter {
|
|
return &Adapter{}
|
|
}
|
|
|
|
func (a *Adapter) Key() string {
|
|
return Key
|
|
}
|
|
|
|
func (a *Adapter) Parse(ctx context.Context, req contracts.ParseRequest) (*source.SourceDocument, error) {
|
|
return nil, fmt.Errorf("seriatim input: source document parsing is not implemented")
|
|
}
|
|
|
|
func ModuleSpec() pipeline.ModuleSpec {
|
|
return pipeline.ModuleSpec{
|
|
Key: Key,
|
|
Stage: pipeline.StageInput,
|
|
Provides: append([]string(nil), providedCapabilities...),
|
|
}
|
|
}
|
|
|
|
func Register(registry *pipeline.InputAdapterRegistry) error {
|
|
return registry.RegisterWithSpec(ModuleSpec(), func() (contracts.InputAdapter, error) {
|
|
return New(), nil
|
|
})
|
|
}
|