plexus.processors.DeepgramFormatProcessor module
- class plexus.processors.DeepgramFormatProcessor.DeepgramFormatProcessor(**parameters)
Bases:
ProcessorProcessor that formats Deepgram structured data into configurable text.
Reads metadata[‘deepgram’] and generates formatted text for ScoreInput.text. Unlike DeepgramInputSource (which only reads channel 0), this processor merges data from ALL channels sorted by time, properly handling stereo recordings where channel 0 = agent, channel 1 = customer.
- Parameters:
- format: “paragraphs” | “sentences” | “words” (default: “paragraphs”)
paragraphs: Groups of sentences, separated by blank lines
sentences: Individual sentences, one per line
words: Space-separated words
speaker_labels: bool (default: False) — prefix with “Speaker N: ” include_timestamps: bool (default: False) — prefix with “[12.50s]” channel: int or None (default: None) — filter to a specific channel
- Example usage in YAML:
- item:
class: DeepgramInputSource options:
pattern: ‘.*deepgram.*.json$’ format: paragraphs include_raw_data: true
- processors:
class: DeepgramFormatProcessor parameters:
format: sentences speaker_labels: true channel: 1 # Customer channel only
Initialize the processor with configuration parameters.
- Args:
**parameters: Processor-specific configuration parameters
- process(score_input: Score.Input) Score.Input
Transform a Score.Input.
- Args:
score_input: Input to transform (contains text, metadata, results)
- Returns:
Transformed Score.Input with modified text/metadata