Aggregators
SentenceAggregator
Frame processor that combines text frames into complete sentences
Overview
SentenceAggregator
is a processor that aggregates text content across multiple frames until it detects complete sentences. It helps maintain natural speech patterns by ensuring text is output in complete semantic units.
Constructor
The processor maintains an internal buffer for text aggregation.
Input Frames
TextFrame
Frame
Contains text content to be aggregated
EndFrame
Frame
Signals the end of processing, forcing output of any remaining text
InterimTranscriptionFrame
Frame
Ignored by the processor (passed through)
Output Frames
TextFrame
Frame
Contains complete sentences after aggregation
Sentence Detection
The processor uses match_endofsentence()
to detect sentence boundaries, which typically include:
- Periods (.)
- Question marks (?)
- Exclamation points (!)
- Other sentence-ending punctuation
Processing Pattern
Usage Examples
Basic Sentence Aggregation
Handling End of Processing
Pipeline Integration
Notes
- Ignores interim transcription frames
- Maintains spacing between text fragments
- Outputs only on sentence completion or EndFrame
- Preserves original punctuation
- Thread-safe for pipeline processing
- Handles multiple sentences in single frames
- Maintains order of non-text frames
Error Handling
The processor handles common edge cases:
- Empty text frames
- Multiple sentence endings
- Missing spaces between fragments
- Incomplete sentences at end of stream
Best Practices
- Ensure proper text spacing in input frames
- Use EndFrame to flush incomplete sentences
- Consider sentence detection requirements for your language
- Monitor buffer size for very long sentences