nemo_voice_agent.pipecat.utils.text.simple_text_aggregator
nemo_voice_agent.pipecat.utils.text.simple_text_aggregator
Module Contents
Classes
Functions
API
Bases: SimpleTextAggregator
A simple text aggregator that segments the text into sentences based on punctuation marks.
find the end of text segment.
Parameters:
The text to find the end of the segment.
Returns: Optional[int]
The index of the end of the segment, or None if the text is too short.
Aggregate the input text and return the first complete sentence in the text.
Parameters:
The text to aggregate.
Returns: AsyncIterator[Aggregation]
The first complete sentence in the text, or None if none is found.
Find the last occurrence of a valid comma in the text, ignoring the commas in the numbers (e.g., “1,234,567”). If the leftover text after the comma is too short, it may be an abbreviation, return -1.
Returns: The index of the last occurrence of a valid comma, or -1 if no valid comma is found.
Parameters:
The text to find the last occurrence of a valid comma.
The minimum length of the leftover text after the rightmost comma to be considered as a valid sentence (e.g., “Santa Clara, CA, US.”).
Find the last occurrence of a period in the text, but return -1 if the text doesn’t seem to be a complete sentence.
Check if the text ends with a partial decimal.
Returns True if the text ends with a number that looks like it could be a partial decimal (e.g., “3.”, “3.14”, “(3.14.”) or a bullet point (e.g., “1. Alpha; 2.”).