Michael Hansen commited on
Commit
a5400b9
1 Parent(s): fa406ff
Files changed (1) hide show
  1. _script/voicefest.py +40 -12
_script/voicefest.py CHANGED
@@ -18,6 +18,7 @@ class Language:
18
 
19
 
20
  _LANGUAGES = {
 
21
  "ca_ES": Language("Català", "Catalan", "Spain"),
22
  "cs_CZ": Language("Čeština", "Czech", "Czech Republic"),
23
  "da_DK": Language("Dansk", "Danish", "Denmark"),
@@ -66,20 +67,47 @@ def add_languages():
66
  lang_code, dataset, quality = onnx_path.stem.split("-")
67
  is_changed = False
68
 
69
- if "language" not in config:
70
- lang_info = _LANGUAGES.get(lang_code)
71
- assert lang_info is not None, f"Missing name for language: {lang_code}"
72
 
73
- lang_family, lang_region = lang_code.split("_", maxsplit=1)
74
- config["language"] = {
75
- "code": lang_code,
76
- "family": lang_family,
77
- "region": lang_region,
78
- "name_native": lang_info.native,
79
- "name_english": lang_info.english,
80
- "country_english": lang_info.country,
81
- }
 
 
 
82
  is_changed = True
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
 
84
  if "dataset" not in config:
85
  config["dataset"] = dataset
 
18
 
19
 
20
  _LANGUAGES = {
21
+ "ar_JO": Language("العربية", "Arabic", "Jordan"),
22
  "ca_ES": Language("Català", "Catalan", "Spain"),
23
  "cs_CZ": Language("Čeština", "Czech", "Czech Republic"),
24
  "da_DK": Language("Dansk", "Danish", "Denmark"),
 
67
  lang_code, dataset, quality = onnx_path.stem.split("-")
68
  is_changed = False
69
 
70
+ lang_info = _LANGUAGES.get(lang_code)
71
+ assert lang_info is not None, f"Missing name for language: {lang_code}"
 
72
 
73
+ lang_family, lang_region = lang_code.split("_", maxsplit=1)
74
+ lang_dict = {
75
+ "code": lang_code,
76
+ "family": lang_family,
77
+ "region": lang_region,
78
+ "name_native": lang_info.native,
79
+ "name_english": lang_info.english,
80
+ "country_english": lang_info.country,
81
+ }
82
+
83
+ if "language" not in config:
84
+ config["language"] = lang_dict
85
  is_changed = True
86
+ else:
87
+ current_lang_dict = config["language"]
88
+ if "code" not in current_lang_dict:
89
+ current_lang_dict["code"] = lang_dict["code"]
90
+ is_changed = True
91
+
92
+ if "family" not in current_lang_dict:
93
+ current_lang_dict["family"] = lang_dict["family"]
94
+ is_changed = True
95
+
96
+ if "region" not in current_lang_dict:
97
+ current_lang_dict["region"] = lang_dict["region"]
98
+ is_changed = True
99
+
100
+ if "name_native" not in current_lang_dict:
101
+ current_lang_dict["name_native"] = lang_dict["name_native"]
102
+ is_changed = True
103
+
104
+ if "name_english" not in current_lang_dict:
105
+ current_lang_dict["name_english"] = lang_dict["name_english"]
106
+ is_changed = True
107
+
108
+ if "country_english" not in current_lang_dict:
109
+ current_lang_dict["country_english"] = lang_dict["country_english"]
110
+ is_changed = True
111
 
112
  if "dataset" not in config:
113
  config["dataset"] = dataset