roedoejet / g2p

Grapheme-to-Phoneme transductions that preserve input and output indices, and support cross-lingual g2p!
https://g2p-studio.herokuapp.com
Other
119 stars 26 forks source link

`g2p generate-mapping` gives useless and cryptic warning for null outputs #353

Closed dhdaines closed 3 months ago

dhdaines commented 3 months ago

Create a mapping foo_to_ipa.csv with this:

foo,

Running g2p generate-mapping (after running g2p update, etc) gives this error:

WARNING - Rule with input '' and output '' has no input. This is disallowed. Please check your mapping file for rules with null inputs.

But... the input isn't null! It's "foo"!

Oh, wait ... the output of that rule, which is the input for the generated IPA mapping, yes, that is actually null.

This warning should get silenced as it is quite confusing!

joanise commented 3 months ago

In fact, I would argue the bug is of a different nature: generate-mapping should skip any rule whose output is empty, and not generate the ''->'' rule you're seeing warnings about.

dhdaines commented 3 months ago

In fact, I would argue the bug is of a different nature: generate-mapping should skip any rule whose output is empty, and not generate the ''->'' rule you're seeing warnings about.

Indeed, that is the right way to fix it, not just silencing the warning, oops!

I'll make a PR for generate-mapping to fix #354 and fix this too