Skip to content

Bantu ITN: a run of number words never starts with a join word - #544

Open
cal3bdev wants to merge 1 commit into
NVIDIA:staging/bantu_itnfrom
cal3bdev:bantu-join-tie
Open

cal3bdev wants to merge 1 commit into
NVIDIA:staging/bantu_itnfrom
cal3bdev:bantu-join-tie

Conversation

@cal3bdev

@cal3bdev cal3bdev commented Nov 24, 2026 •

Copy link
Copy Markdown

Follow-up to #518. Fixes the one input pattern where the Bantu kernel left two equally best readings for the runtime to choose between.

The problem

Join words such as Luganda mu ("in") or Swahili na ("and") are also ordinary words. A run of number words could start with one, so kasa vo mina epi (test language) had two readings with exactly the same weight:

  • vo as a word, then mina epi as an amount: kasa vo 20,000 XTS
  • vo mina epi as one malformed run, left unchanged

This isn't randomness. NeMo always picks the same reading for a given build (today the conversion), but only because of the order the paths happen to be in. A rebuild or Sparrowhawk could pick the other. In Luganda it shows up as omuwendo guli mu mitwalo ebiri.

The change

join_aware_runs in bantu/graph_utils.py: a run now starts with a number word that is not a join. Joins that come before the first run with no ordinary word (or that make up the whole input) are words. Joins between number words still extend the run, and a run can still end on a join at the end of the input, as before.

Output

  • On the 12,121 generated inputs used for Bantu ITN: shared kernel with a test-only language profile #518, the output text is unchanged. The one difference is that koin ke mina otodeka now has one best reading instead of two.
  • An input that starts with a join and then an amount now converts: vo mina epi -> vo 20,000 XTS (it was left unchanged as a malformed run).

Tests

  • 5 new test-language cases: kasa vo mina epi, kasa ke mina otodeka, vo mina epi, vo mina epi vo kasa (money) and vo ke (word). Each also checks for exactly one best reading.
  • pytest tests/nemo_text_processing/bantu tests/nemo_text_processing/toy --cpu: 160 passed, 100% line coverage of bantu/ and toy/.
  • black and isort with the pre-commit settings, plus pyflakes: clean.
  • Our 205 reviewed Luganda cases still all pass, with no ties.

No other files changed. The import cycle and header fix are left for the refactor, as agreed.

A join word such as Luganda "mu" ("in") is also an ordinary word. A run of
number words could start with one, so "kasa vo mina epi" had two equally best
readings: "vo" as a word followed by 20,000 XTS, or "vo mina epi" as one
malformed run left unchanged. The runtime picked one silently.

Runs now start with a number word that is not a join. Joins before the first
run with no ordinary word (or the whole input) are words. On 12,121 generated
inputs the output is unchanged; the one difference is that "koin ke mina
otodeka" now has one best reading instead of two (same text). An input that
starts with a join and then an amount now converts: "vo mina epi" ->
"vo 20,000 XTS" (was left unchanged).

Signed-off-by: Lwanga Caleb <[email protected]>
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