Skip to content

Langs

LangItem dataclass

A class for storing language information.

Source code in models/config/langs.py
33
34
35
36
37
38
39
40
@dataclass
class LangItem:
    r"""A class for storing language information."""

    phonemizer: str
    phonemizer_espeak: str
    nemo: str
    processing_lang_type: PreprocessLangType

get_lang_map(lang)

Returns a LangItem object for the given language.

Parameters:

Name Type Description Default
lang str

The language to get the LangItem for.

required

Raises:

Type Description
ValueError

If the language is not supported.

Returns:

Name Type Description
LangItem LangItem

The LangItem object for the given language.

Source code in models/config/langs.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def get_lang_map(lang: str) -> LangItem:
    r"""Returns a LangItem object for the given language.

    Args:
        lang (str): The language to get the LangItem for.

    Raises:
        ValueError: If the language is not supported.

    Returns:
        LangItem: The LangItem object for the given language.
    """
    if lang not in langs_map:
        raise ValueError(f"Language {lang} is not supported!")
    return langs_map[lang]