> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/labs-voice-agent/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/labs-voice-agent/_mcp/server.

# nemo_voice_agent.pipecat.utils.text.simple_text_aggregator

## Module Contents

### Classes

| Name                                                                                                                         | Description                                                                                |
| ---------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| [`SimpleSegmentedTextAggregator`](#nemo_voice_agent-pipecat-utils-text-simple_text_aggregator-SimpleSegmentedTextAggregator) | A simple text aggregator that segments the text into sentences based on punctuation marks. |

### Functions

| Name                                                                                                           | Description                                            |
| -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| [`find_last_comma_index`](#nemo_voice_agent-pipecat-utils-text-simple_text_aggregator-find_last_comma_index)   | Find the last occurrence of a valid comma in the text, |
| [`find_last_period_index`](#nemo_voice_agent-pipecat-utils-text-simple_text_aggregator-find_last_period_index) | Find the last occurrence of a period in the text,      |
| [`has_partial_decimal`](#nemo_voice_agent-pipecat-utils-text-simple_text_aggregator-has_partial_decimal)       | Check if the text ends with a partial decimal.         |

### API

```python
class nemo_voice_agent.pipecat.utils.text.simple_text_aggregator.SimpleSegmentedTextAggregator(
    punctuation_marks: str | list[str] = '.,!?;:\n',
    ignore_marks: str | list[str] = '*',
    min_sentence_length: int = 0,
    use_legacy_eos_detection: bool = False,
    kwargs = {}
)
```

**Bases:** `SimpleTextAggregator`

A simple text aggregator that segments the text into sentences based on punctuation marks.

**`_ignore_marks`**

---

**`_punctuation_marks`**

---

```python
nemo_voice_agent.pipecat.utils.text.simple_text_aggregator.SimpleSegmentedTextAggregator._find_segment_end(
    text: str
) -> typing.Optional[int]
```

find the end of text segment.

**Parameters:**

**`text`**

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.

```python
nemo_voice_agent.pipecat.utils.text.simple_text_aggregator.SimpleSegmentedTextAggregator.aggregate(
    text: str
) -> typing.AsyncIterator[pipecat.utils.text.base_text_aggregator.Aggregation]
```

async

Aggregate the input text and return the first complete sentence in the text.

**Parameters:**

**`text`**

The text to aggregate.

---

**Returns:** `AsyncIterator[Aggregation]`

The first complete sentence in the text, or None if none is found.

```python
nemo_voice_agent.pipecat.utils.text.simple_text_aggregator.find_last_comma_index(
    text: str,
    min_residual_length: int = 5
) -> int
```

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:**

**`text`**

The text to find the last occurrence of a valid comma.

---

**`min_residual_length`**

The minimum length of the leftover text after the rightmost comma
to be considered as a valid sentence (e.g., "Santa Clara, CA, US.").

---

```python
nemo_voice_agent.pipecat.utils.text.simple_text_aggregator.find_last_period_index(
    text: str
) -> int
```

Find the last occurrence of a period in the text,
but return -1 if the text doesn't seem to be a complete sentence.

```python
nemo_voice_agent.pipecat.utils.text.simple_text_aggregator.has_partial_decimal(
    text: str
) -> bool
```

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)"), but NOT if it's
clearly a complete sentence (e.g., "It costs $3.14.") or a bullet point
(e.g., "1. Alpha; 2.").