Skip to content

Polish audio TN - #470

Draft
jimregan wants to merge 31 commits into
NVIDIA:mainfrom
jimregan:polish-tn
Draft

jimregan wants to merge 31 commits into
NVIDIA:mainfrom
jimregan:polish-tn

Conversation

@jimregan

@jimregan jimregan commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

Audio TN for Polish. Also TN, but that has too many non-determinisms to care about

Before your PR is "Ready for review"

Pre checks:

  • Have you signed your commits? Use git commit -s to sign.
  • Do all unittests finish successfully before sending PR?
    1. pytest or (if your machine does not have GPU) pytest --cpu from the root folder (given you marked your test cases accordingly @pytest.mark.run_only_on('CPU')).
    2. Sparrowhawk tests bash tools/text_processing_deployment/export_grammars.sh --MODE=test ...
  • If you are adding a new feature: Have you added test cases for both pytest and Sparrowhawk here.
  • Have you added __init__.py for every folder and subfolder, including data folder which has .TSV files?
  • Have you followed codeQL results and removed unused variables and imports (report is at the bottom of the PR in github review box) ?
  • Have you added the correct license header Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. to all newly added Python files?
  • If you copied nemo_text_processing/text_normalization/en/graph_utils.py your header's second line should be Copyright 2015 and onwards Google, Inc.. See an example here.
  • Remove import guards (try import: ... except: ...) if not already done.
  • If you added a new language or a new feature please update the NeMo documentation (lives in different repo).
  • Have you added your language support to tools/text_processing_deployment/pynini_export.py.

PR Type:

  • New Feature
  • Bugfix
  • Documentation
  • Test

If you haven't finished some of the above items you can still open "Draft" PR.

jimregan and others added 2 commits August 8, 2026 00:02
Signed-off-by: Jim O'Regan <joregan@kth.se>
@jimregan
jimregan marked this pull request as draft August 7, 2026 23:09
jimregan and others added 22 commits August 8, 2026 08:52
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
…into polish-tn

Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O’Regan <joregan@kth.se>
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 14 days with no activity. Remove stale label or comment or update or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Aug 31, 2026
Note that Google Translate's TTS can manage 0,00000000000000001 ("zero i jedna stubiliardowa") but higher than that it becomes stupid: 0,000000000000000001 comes out as "zero jeden przez zero...(18 times)" ("zero one divided by zero zero etc.")

Signed-off-by: Jim O'Regan <joregan@kth.se>
@github-actions github-actions Bot removed the Stale label Sep 2, 2026
@tbartley94 tbartley94 self-assigned this Sep 11, 2026
pl_acc ny
pl_ins nami
pl_loc nach
pl_voc ny No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is something about new line different that in other files, i am not sure if that is important.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's likely just an artifact of his editor. Not a problem for the parser.

pl_nom le
pl_gen l
pl_dat lom
pl_acc li

@toleniecki toleniecki Sep 14, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that does not generalize by ending, i think there is some other word feature other than ending and genus in play. e.g.
sg_nom "fala" (wave) pl_acc is "fale", not "fali" as this file suggests.

but it works for names:
sg_nom "Ala" produces pl_acc "Ali".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only used with names at the moment (specifically, names of queens or saints to disambiguate a trailing roman numeral or a leading 'św.' respectively)

sg_nom <eps>
sg_gen a
sg_dat owi
sg_acc <eps>

@toleniecki toleniecki Sep 14, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here again the rule is more complex than ending alone, but this time i happen to know it has something to do with the object being inanimate vs animate (person, animal, plant). e.g.:
"kolec" (spike) sg_acc is "kolec", while animate thing like "golec" in sg acc becomes "golca".

if "mi" in the file name stands for "male inanimate", the it dismisses the comment, but then there is no "mp_c" file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intended for [^e]c, I would have had noun_mi_ec.tsv for the case you're describing, and sg_nom would be 'ec' because the e is deleted. Same with -iec, same with -zec for marzec.

It would probably be easier to follow if I were to name everything in terms of a specific noun but I don't honestly imagine that anybody else will be working on this.

@@ -0,0 +1,14 @@
sg_nom m
sg_gen ma

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if "mi" is "male inanimate", but assuming that -- this is wrong, e.g.:
sg nom "szlam" (sludge) -> sg gen "szlamu"
sg nom "szlem" (slem) -> sg gen "szlemu"
sg nom "dżem" (jam) -> sg gen "dżemu"

so i think it should be "mu"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gram -> grama

@@ -0,0 +1,14 @@
sg_nom r
sg_gen ra

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ru" if it's for inanimate, otherwise "ra" is fine.
e.g.
"katar" (a cold, inanimate) -> "kataru"
"Tatar" (Tatar nation, animate) -> "Tatara"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the types of words that tend to come up in normalisation, it tends to be -a for inanimate (cetnar -> cetnara)

@@ -0,0 +1,24 @@
1 dziesiąty

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"dziesiętny", if it is about denominators.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the file is poorly named, but it's decimal denominators purely, so for decimal I,D if len(D) == 1, the denominator is "tenth", len(D) == 2, "hundredth", etc.

@toleniecki toleniecki Sep 14, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the title says "denominators", but then list all the words suggesting that they are male. we typically refer to fractions as females, so "0,1" reads "zero i jedna dziesiąta" (zero and one tenth, where "thenth" is female, thus "-a", not "-y").
i am not sure what the purpose of this file is, but if its to produce TTS of "0,001" and so one, that should all end with -a instead of -y

but then it becomes plural if its anything other than "1", so e.g. "0,2" is "0 i 2 dziesiętne", "0,3" is "0 i 3 dziesiętne" etc. + above 5 it becomes "0 i 5 dziesiętnych".

note that i am not bothering you here with how to read and write numbers on purpose, because that thing alone is a huge decision tree.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjectives are relatively regular in terms of inflection, this is reusing the same mechanism that's used for ordinals.

o 4.25~o czwartej dwadzieścia pięć
o godz. 21:14~o godzinie dwudziestej pierwszej czternaście
4:25~czwarta dwadzieścia pięć
04:25:07~czwarta dwadzieścia pięć siedem

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sounds too much machine style. The human would say:
"czwarta dwadzieścia pięć i siedem sekund"

o godz. 21:14~o godzinie dwudziestej pierwszej czternaście
4:25~czwarta dwadzieścia pięć
04:25:07~czwarta dwadzieścia pięć siedem
00:00:00~zero zero zero

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar here, human would say: "północ" -> midnight

zero przecinek zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero zero dwa
~1,5
jeden i pięć dziesiątych
jeden przecinek pięć

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"jeden i pół" is perfectly fine here and to me that would be the most obvious one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, reading the decimal as a fraction would be more natural, but that's a specific set of exceptions to normal decimal handling. This is a draft, I'll get to it when I have time.

Maybe having a simple example here is misleading? 1,5 looks quite clear cut, but 1,56734 less so.

~1,5 kg
jeden i pięć dziesiątych kilograma
jeden przecinek pięć kilograma
półtora kilograma

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"jeden i pół kilograma" is perfectly fine here as well

Signed-off-by: Jim O'Regan <joregan@kth.se>
…absent from the test)

Signed-off-by: Jim O'Regan <joregan@kth.se>
@@ -0,0 +1,14 @@
sg_nom t
sg_gen ta

@toleniecki toleniecki Sep 15, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if its for "male inanimate", it should be "-tu", as in:
"blat"(couneter) -> sg gen "blatu"

for animate things its fine, e.g. "kot" (cat) -> sg gen "kota"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wat -> wata
Again, the point here is not to provide general inflection tables, but to target the kind of words that appear in normalisation, which overwhelmingly tend to have genitives in -a, not -u

Comment thread nemo_text_processing/text_normalization/pl/data/grammar/noun_mi_tr.tsv Outdated
Comment thread nemo_text_processing/text_normalization/pl/data/grammar/noun_mi_tr.tsv Outdated
Signed-off-by: Jim O'Regan <joregan@kth.se>
Signed-off-by: Jim O'Regan <joregan@kth.se>
mm milimetr mi noun_mi_r.tsv
l litr mi noun_mi_r.tsv
ml mililitr mi noun_mi_r.tsv
g gram mi noun_mi_m.tsv

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toleniecki does this clear things up?

jimregan and others added 2 commits September 16, 2026 21:05
Signed-off-by: Jim O'Regan <joregan@kth.se>
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.

4 participants