plexus.processors.AddEnumeratedSpeakerIdentifiersTranscriptFilter module

class plexus.processors.AddEnumeratedSpeakerIdentifiersTranscriptFilter.AddEnumeratedSpeakerIdentifiersTranscriptFilter(**parameters)

Bases: Processor

Replace speaker identifiers with enumerated labels (Speaker A, Speaker B, etc.).

This processor does a two-pass operation: 1. First pass: Identify all unique speaker identifiers in the order they appear 2. Second pass: Replace each speaker identifier with Speaker A, Speaker B, etc.

Example:

Before: “Agent: Hello. Customer: Hi. Agent: How are you?” After: “Speaker A: Hello. Speaker B: Hi. Speaker A: How are you?”

Initialize the processor with configuration parameters.

Args:

**parameters: Processor-specific configuration parameters

enumerate_speakers(text: str) str

Replace speaker identifiers with enumerated labels.

Args:

text: Input text with speaker identifiers

Returns:

Text with speakers replaced by Speaker A, Speaker B, etc.

process(score_input: Score.Input) Score.Input

Process the Score.Input by enumerating speaker identifiers.

Args:

score_input: Score.Input with text

Returns:

Score.Input with enumerated speaker identifiers