Skip to content

Speak one dollar and one cent in the singular - #16324

Open
SashaMIT wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
SashaMIT:fix/dollar-singular
Open

SashaMIT wants to merge 1 commit into
NVIDIA-NeMo:mainfrom
SashaMIT:fix/dollar-singular

Conversation

@SashaMIT

Copy link
Copy Markdown

What does this PR do ?

clean_numbers("$1") returned "one dollars". clean_numbers("$1.01") returned "one dollars and one cents". clean_numbers("$2.01") returned "two dollars and one cents".

The dollar plural compared the amount string to the integer 1. The amount still includes the dollar sign, so that comparison was never true. The cent plural compared the dollar string to the cent text, so one cent was plural whenever the two strings differed.

The count is now the digits in each amount. $2.02 is still "two dollars and two cents". $10 is still "ten dollars". $1,000 is still "one thousand dollars".

No existing issue.

Collection: common (text normalization)

Changelog

  • Count the digits in a currency amount before choosing "dollar" or "cent".

Usage

from nemo.collections.common.parts.preprocessing.cleaners import clean_numbers

clean_numbers("$1.01")  # one dollar and one cent

GitHub Actions CI

The Jenkins CI system has been replaced by GitHub Actions self-hosted runners.

Trusted PRs run automatically through copy-pr-bot. For an untrusted PR, a maintainer can trigger CI by commenting
/ok to test <head-sha>; repeat this after a new push if the PR remains untrusted.

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)
    • Reviewer: Does the PR have correct import guards for all optional libraries?

inflect was already optional. This change does not import it from a new place.

Drafted with Grok 4.7. The code has not yet been reviewed by a human.

The currency amount still included the dollar sign, so it never equaled 1, and the cent plural was chosen by comparing that string to the cent text.

Signed-off-by: Sasha Mitchell <sash.t.mitchell@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 30, 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant