ciyidogan commited on
Commit
5ab11dd
·
verified ·
1 Parent(s): 911913b

Update stt/stt_google.py

Browse files
Files changed (1) hide show
  1. stt/stt_google.py +14 -0
stt/stt_google.py CHANGED
@@ -36,20 +36,34 @@ class GoogleSTT(STTInterface):
36
  """Map language codes to Google format"""
37
  # Google uses BCP-47 language codes
38
  language_map = {
 
39
  "tr-TR": "tr-TR",
 
40
  "en-US": "en-US",
41
  "en-GB": "en-GB",
 
42
  "de-DE": "de-DE",
 
43
  "fr-FR": "fr-FR",
 
44
  "es-ES": "es-ES",
 
45
  "it-IT": "it-IT",
 
46
  "pt-BR": "pt-BR",
 
47
  "ru-RU": "ru-RU",
 
48
  "ja-JP": "ja-JP",
 
49
  "ko-KR": "ko-KR",
 
50
  "zh-CN": "zh-CN",
 
51
  "ar-SA": "ar-SA",
52
  }
 
 
53
  return language_map.get(language, language)
54
 
55
  async def transcribe(self, audio_data: bytes, config: STTConfig) -> Optional[TranscriptionResult]:
 
36
  """Map language codes to Google format"""
37
  # Google uses BCP-47 language codes
38
  language_map = {
39
+ "tr": "tr-TR",
40
  "tr-TR": "tr-TR",
41
+ "en": "en-US",
42
  "en-US": "en-US",
43
  "en-GB": "en-GB",
44
+ "de": "de-DE",
45
  "de-DE": "de-DE",
46
+ "fr": "fr-FR",
47
  "fr-FR": "fr-FR",
48
+ "es": "es-ES",
49
  "es-ES": "es-ES",
50
+ "it": "it-IT",
51
  "it-IT": "it-IT",
52
+ "pt": "pt-BR",
53
  "pt-BR": "pt-BR",
54
+ "ru": "ru-RU",
55
  "ru-RU": "ru-RU",
56
+ "ja": "ja-JP",
57
  "ja-JP": "ja-JP",
58
+ "ko": "ko-KR",
59
  "ko-KR": "ko-KR",
60
+ "zh": "zh-CN",
61
  "zh-CN": "zh-CN",
62
+ "ar": "ar-SA",
63
  "ar-SA": "ar-SA",
64
  }
65
+
66
+ # Default to the language itself if not in map
67
  return language_map.get(language, language)
68
 
69
  async def transcribe(self, audio_data: bytes, config: STTConfig) -> Optional[TranscriptionResult]: