File size: 4,372 Bytes
39f7b40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cfd5440
 
39f7b40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cfd5440
39f7b40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# Languages dict
LANGUAGE_NAME_TO_CODE = {
    "العربية": "ar_AR",
    "Čeština": "cs_CZ",
    "Deutsch": "de_DE",
    "English": "en_XX",
    "Español": "es_XX",
    "Eesti": "et_EE",
    "Suomi": "fi_FI",
    "Français": "fr_XX",
    "ગુજરાતી": "gu_IN",
    "हिन्दी": "hi_IN",
    "Italiano": "it_IT",
    "日本語": "ja_XX",
    "Қазақ": "kk_KZ",
    "한국어": "ko_KR",
    "Lietuvių": "lt_LT",
    "Latviešu": "lv_LV",
    "ဗမာ": "my_MM",
    "नेपाली": "ne_NP",
    "Nederlands": "nl_XX",
    "Română": "ro_RO",
    "Русский": "ru_RU",
    "සිංහල": "si_LK",
    "Türkçe": "tr_TR",
    "Tiếng Việt": "vi_VN",
    "中文": "zh_CN",
    "Afrikaans": "af_ZA",
    "Azərbaycan": "az_AZ",
    "বাংলা": "bn_IN",
    "فارسی": "fa_IR",
    "עברית": "he_IL",
    "Hrvatski": "hr_HR",
    "Indonesia": "id_ID",
    "ქართული": "ka_GE",
    "ខ្មែរ": "km_KH",
    "Македонски": "mk_MK",
    "മലയാളം": "ml_IN",
    "Монгол": "mn_MN",
    "मराठी": "mr_IN",
    "Polski": "pl_PL",
    "پښتو": "ps_AF",
    "Português": "pt_XX",
    "Svenska": "sv_SE",
    "Kiswahili": "sw_KE",
    "தமிழ்": "ta_IN",
    "తెలుగు": "te_IN",
    "ไทย": "th_TH",
    "Tagalog": "tl_XX",
    "Українська": "uk_UA",
    "اردو": "ur_PK",
    "isiXhosa": "xh_ZA",
    "Galego": "gl_ES",
    "Slovenščina": "sl_SI"
}

# Whisper languages dict
WHISPER_LANGUAGES = {
    "en": "english",
    "zh": "chinese",
    "de": "german",
    "es": "spanish",
    "ru": "russian",
    "ko": "korean",
    "fr": "french",
    "ja": "japanese",
    "pt": "portuguese",
    "tr": "turkish",
    "pl": "polish",
    "ca": "catalan",
    "nl": "dutch",
    "ar": "arabic",
    "sv": "swedish",
    "it": "italian",
    "id": "indonesian",
    "hi": "hindi",
    "fi": "finnish",
    "vi": "vietnamese",
    "he": "hebrew",
    "uk": "ukrainian",
    "el": "greek",
    "ms": "malay",
    "cs": "czech",
    "ro": "romanian",
    "da": "danish",
    "hu": "hungarian",
    "ta": "tamil",
    "no": "norwegian",
    "th": "thai",
    "ur": "urdu",
    "hr": "croatian",
    "bg": "bulgarian",
    "lt": "lithuanian",
    "la": "latin",
    "mi": "maori",
    "ml": "malayalam",
    "cy": "welsh",
    "sk": "slovak",
    "te": "telugu",
    "fa": "persian",
    "lv": "latvian",
    "bn": "bengali",
    "sr": "serbian",
    "az": "azerbaijani",
    "sl": "slovenian",
    "kn": "kannada",
    "et": "estonian",
    "mk": "macedonian",
    "br": "breton",
    "eu": "basque",
    "is": "icelandic",
    "hy": "armenian",
    "ne": "nepali",
    "mn": "mongolian",
    "bs": "bosnian",
    "kk": "kazakh",
    "sq": "albanian",
    "sw": "swahili",
    "gl": "galician",
    "mr": "marathi",
    "pa": "punjabi",
    "si": "sinhala",
    "km": "khmer",
    "sn": "shona",
    "yo": "yoruba",
    "so": "somali",
    "af": "afrikaans",
    "oc": "occitan",
    "ka": "georgian",
    "be": "belarusian",
    "tg": "tajik",
    "sd": "sindhi",
    "gu": "gujarati",
    "am": "amharic",
    "yi": "yiddish",
    "lo": "lao",
    "uz": "uzbek",
    "fo": "faroese",
    "ht": "haitian creole",
    "ps": "pashto",
    "tk": "turkmen",
    "nn": "nynorsk",
    "mt": "maltese",
    "sa": "sanskrit",
    "lb": "luxembourgish",
    "my": "myanmar",
    "bo": "tibetan",
    "tl": "tagalog",
    "mg": "malagasy",
    "as": "assamese",
    "tt": "tatar",
    "haw": "hawaiian",
    "ln": "lingala",
    "ha": "hausa",
    "ba": "bashkir",
    "jw": "javanese",
    "su": "sundanese",
}

def union_language_dict():
    # Create a dictionary to store the language codes
    language_dict = {}
    # Iterate over the LANGUAGE_NAME_TO_CODE dictionary
    for language_name, language_code in LANGUAGE_NAME_TO_CODE.items():
        # Extract the language code (the first two characters before the underscore)
        lang_code = language_code.split('_')[0].lower()
        
        # Check if the language code is present in WHISPER_LANGUAGES
        if lang_code in WHISPER_LANGUAGES:
            # Construct the entry for the resulting dictionary
            language_dict[language_name] = {
                "transcriber": lang_code,
                "translator": language_code
            }
    return language_dict