Skip to content

fix(en-tn): verbalize plural time unit abbreviations (mins/hrs/secs/kgs/wks/mos/yrs) - #509

Open
JMak-Security wants to merge 3 commits into
NVIDIA:mainfrom
JMak-Security:fix/en-tn-plural-time-unit-abbreviations
Open

JMak-Security wants to merge 3 commits into
NVIDIA:mainfrom
JMak-Security:fix/en-tn-plural-time-unit-abbreviations

Conversation

@JMak-Security

Copy link
Copy Markdown

Supersedes #479, which the stale bot closed while CI was green and the PR was mergeable.

GitHub will not let me reopen #479: rebasing the branch onto current main required a force-push, and reopening is refused after a force-push (state cannot be changed ... the branch was force-pushed or recreated). So this is the same fix, rebased, with the regression coverage that was missing from the original revision, and a fresh PR to go with it.

What this does

en/data/measure/unit.tsv maps the singular time abbreviations min, sec, hr to their spoken forms, but not the plural written forms mins, hrs, secs. Since measure normalization only fires when the written token is recognised as a unit, the plural forms pass through unverbalized:

'5 mins'   -> 'five mins'          # should be 'five minutes'
'2 hrs'    -> 'two HRS'            # should be 'two hours'
'2-3 mins' -> 'two - three mins'   # should be 'two to three minutes'

The range case is the more visible failure: the measure range rule cannot fire either, so the hyphen from 2-3 is left in the output, which TTS renders as silence/a pause.

Scope

Limited to the units that take a colloquial s plural: min/mins, sec/secs, hr/hrs, kg/kgs, wk/wks, mo/mos, yr/yrs. SI symbols (km, mm, GB, kW, …) are deliberately untouched, as those are not written that way. kgs mirrors the already-existing lbs -> pound precedent.

The scope question raised in review on #479 is resolved in favour of exactly this set.

Verification

Run with python 3.10 + pynini==2.1.6.post1 on both trees:

pytest tests/nemo_text_processing/en/test_measure.py --cpu
input main (before) this PR (after)
5 mins five mins five minutes
2 hrs two HRS two hours
30 secs thirty secs thirty seconds
3 kgs three kgs three kilograms
2 wks two wks two weeks
6 mos six mos six months
5 yrs five yrs five years
2-3 mins two - three mins two to three minutes
5 min five minutes five minutes (unchanged)
1 sec one second one second (unchanged)
  • main: 253 passed
  • this PR: 268 passed (253 pre-existing + 15 new), 0 failed

15 cases were added to en/data_text_normalization/test_cases_measure.txt covering all seven plural units plus singular controls, so this cannot silently regress. The original revision changed data only, with no test exercising the behaviour, which is likely why it kept getting passed over.

Changes

  1. fix(en-tn): verbalize plural time unit abbreviations (mins/hrs/secs)
  2. fix(en-tn): add kgs/wks/mos/yrs plural unit abbreviations
  3. test(en-tn): add regression cases for plural unit abbreviations

Could someone take a look when convenient? And if en TN fixes are no longer landing in this repo, I would appreciate a pointer to where they should go instead — happy to re-target.

en/data/measure/unit.tsv maps the singular abbreviations min, sec, hr
to their spoken forms, but not the plural written forms mins, hrs,
secs. Since measure normalization only fires when the written token
is recognized as a unit, the plural forms pass through unverbalized:

  '5 mins'    -> 'five mins'         (should be 'five minutes')
  '2-3 mins'  -> 'two - three mins'  (should be 'two to three minutes')

The range case is the more visible failure: the measure range rule
can't fire either, so the hyphen from '2-3' is left in the output --
for TTS this renders as silence.

No grammar change is needed. MeasureFst already derives the spoken
plural from the singular value via
graph_unit_plural = convert_space(graph_unit @ SINGULAR_TO_PLURAL)
(taggers/measure.py), so a plural written key only needs a row
mapping to the existing singular spoken form -- the same pattern
already used for 'lbs -> pound'.

Fixes NVIDIA#477

Signed-off-by: Jason Mak <squrrielbro@gmail.com>
Follow-up per review feedback: the same missing-plural-written-form
bug affects kg/kgs, wk/wks, mo/mos, and yr/yrs, not just the
min/sec/hr family fixed in the previous commit.

Scoped to these four specifically, not a mechanical sweep of every
abbreviation in the file: kgs mirrors the already-existing lbs -> pound
precedent (mass units commonly get colloquial 's' plurals despite SI
style guides discouraging it), and wks/mos/yrs are the same casual
time-count family as mins/hrs/secs. Left the SI symbol portion of the
file (km, mm, GB, kW, etc.) untouched, since those are not commonly
written with a colloquial 's' plural the way day/week/month/year/
hour/minute/second/pound/kilogram are.

Signed-off-by: Jason Mak <squrrielbro@gmail.com>
Covers mins/hrs/secs/kgs/wks/mos/yrs plus singular controls, so the plural verbalization added in this PR is locked in and any future regression in the measure tagger surfaces immediately. Verified: pytest tests/nemo_text_processing/en/test_measure.py --cpu reports 268 passed, 0 failed (253 pre-existing + 15 new).

Signed-off-by: JMAK-Security <squrrielbro@gmail.com>
@JMak-Security
JMak-Security force-pushed the fix/en-tn-plural-time-unit-abbreviations branch from 39ddfdd to 2f5d3ec Compare October 5, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant