NeMo-text-processing icon indicating copy to clipboard operation
NeMo-text-processing copied to clipboard

bug in graph_utils.py of zh ITN and decimal tagger of ar TN

Open hannan72 opened this issue 1 year ago • 3 comments

In the ./nemo_text_processing/inverse_text_normalization/zh/graph_utils.py line 79, load_labels() method is called but it is not imported, So it raises error. It could be simply resolved by adding the following method in ./nemo_text_processing/inverse_text_normalization/zh/utils.py:

def load_labels(abs_path):
    """
    loads relative path file as dictionary

    Args:
        abs_path: absolute path

    Returns dictionary of mappings
    """
    with open(abs_path, encoding="utf-8") as label_tsv:
        labels = list(csv.reader(label_tsv, delimiter="\t"))
    return labels

and import it in ./nemo_text_processing/inverse_text_normalization/zh/graph_utils.py:

from nemo_text_processing.inverse_text_normalization.zh.utils import load_labels

Also there is another bug in arabic TN tagger: In nemo_text_processing/text_normalization/ar/taggers/decimal.py line 40, quantities is not defined. So it could be resolved by adding the following line before it (in line 33):

quantities = pynini.string_file(get_abs_path("data/numbers/quantities.tsv"))

hannan72 avatar Apr 17 '24 11:04 hannan72

Thanks for reporting this @hannan72!

@BuyuanCui could you add the fix for zh in PR112?

@mgrafu could you take a look at ar issue?

ekmb avatar Apr 17 '24 16:04 ekmb

Would update accordingly.

BuyuanCui avatar Apr 18 '24 19:04 BuyuanCui

Updates made

BuyuanCui avatar Apr 18 '24 21:04 BuyuanCui

@hannan72 closing this one as fixed, please re-open if the error persists.

ekmb avatar May 08 '24 16:05 ekmb