Skip to content

fix(voice_agent): recognize a sentence ending in a decimal number as complete - #16219

Open
udsy19 wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
udsy19:fix/text-aggregator-decimal-sentence-boundary
Open

fix(voice_agent): recognize a sentence ending in a decimal number as complete#16219
udsy19 wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
udsy19:fix/text-aggregator-decimal-sentence-boundary

Conversation

@udsy19

@udsy19 udsy19 commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Fixes the voice agent's text aggregator so a sentence ending in a decimal
number (e.g. "It costs $3.14.") is recognized as complete instead of being
buffered forever.

Collection: [voice_agent]

Changelog

  • simple_text_aggregator.py: find_last_period_index's decimal/bullet/
    abbreviation heuristics only ran when the buffered text had exactly one
    period. A second period -- including the decimal point of the sentence's
    own trailing number -- skipped those checks and fell through to a blanket
    "digit before the period -> partial decimal" rule, contradicting
    has_partial_decimal's own docstring example ("It costs $3.14." is
    "clearly ... complete"). Narrowed the fix: a digit before the period is
    only treated as an in-progress decimal when the text up to that period
    isn't already a closed-off decimal number ("X.Y."). Verified against the
    file's other heuristics (bullets, abbreviations, a.m./p.m., bare trailing
    numbers like "at 3.") with zero behavior changes.
  • New tests/agents/voice_agent/test_simple_text_aggregator_decimal_boundary.py.
    nemo.agents.voice_agent needs the optional pipecat-ai/loguru stack,
    not part of this repo's test env, so the test stubs both in sys.modules
    to import the real module and call find_last_period_index directly.

Usage

find_last_period_index("It costs $3.14.")
# previously: -1 (should be 14, the trailing period -- a complete sentence)

Negative control (simple_text_aggregator.py reverted to main, new tests
unchanged): 4 failed, 3 passed in 0.07s -- the 3 passes are the existing,
still-correct ambiguous/bullet/abbreviation cases, proving the fix targets
only the misclassified ones. With the fix: 7 passed in 0.03s.

GitHub Actions CI

Requires a maintainer /ok to test <head-sha>.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you add or update any necessary documentation?
  • Does the PR affect components that are optional to install? (Ex: Numba, Pynini, Apex etc)

PR Type:

  • New Feature
  • Bugfix
  • Documentation

Additional Information

Signed-off-by: Udaya Tejas udayatejas2004@gmail.com

…complete

find_last_period_index()'s decimal/bullet/abbreviation heuristics only run
when the buffered text contains exactly one period. As soon as a second
period appears anywhere in the buffer -- including the decimal point of the
sentence's own trailing number -- those checks are skipped, and the code
falls through to a blanket "digit before the period means partial decimal"
rule. Any sentence ending immediately after a decimal number (e.g. "It costs
$3.14.", the has_partial_decimal docstring's own example of a sentence that
is "clearly ... complete") is therefore misclassified as incomplete, and the
real-time voice agent never flushes it to TTS at its natural sentence
boundary.

Narrow the fix to the specific ambiguity: a digit before the period is only
treated as an in-progress decimal when the substring up to that period does
not already look like a closed-off decimal number ("X.Y."). Verified against
a battery of existing correctly-handled cases (bullets, abbreviations, a.m./
p.m., bare trailing numbers like "at 3.") with zero behavior changes.

Signed-off-by: Udaya Tejas <udayatejas2004@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-request waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SimpleSegmentedTextAggregator never treats a sentence ending in a decimal number as complete

2 participants