tuyenhn commited on
Commit
b5fa991
·
1 Parent(s): af08fe3

change qcri supported language prompt to be same as others

Browse files
deep_translator/constants.py CHANGED
@@ -238,3 +238,13 @@ PAPAGO_CODE_TO_LANGUAGE = {
238
  }
239
 
240
  PAPAGO_LANGUAGE_TO_CODE = {v: k for v, k in PAPAGO_CODE_TO_LANGUAGE.items()}
 
 
 
 
 
 
 
 
 
 
 
238
  }
239
 
240
  PAPAGO_LANGUAGE_TO_CODE = {v: k for v, k in PAPAGO_CODE_TO_LANGUAGE.items()}
241
+
242
+ QCRI_CODE_TO_LANGUAGE = {
243
+ 'ar': 'Arabic',
244
+ 'en': 'English',
245
+ 'es': 'Spanish'
246
+ }
247
+
248
+ QCRI_LANGUAGE_TO_CODE = {
249
+ v: k for k, v in QCRI_CODE_TO_LANGUAGE.items()
250
+ }
deep_translator/qcri.py CHANGED
@@ -1,6 +1,6 @@
1
 
2
  import requests
3
- from deep_translator.constants import BASE_URLS
4
  from deep_translator.exceptions import (
5
  ServerException, TranslationNotFound)
6
 
@@ -40,10 +40,12 @@ class QCRI(object):
40
  except Exception as e:
41
  raise e
42
 
43
- def get_supported_languages(self):
44
-
 
45
  pairs = self._get("get_languages")
46
- return pairs
 
47
 
48
  @property
49
  def languages(self):
 
1
 
2
  import requests
3
+ from deep_translator.constants import BASE_URLS, QCRI_LANGUAGE_TO_CODE
4
  from deep_translator.exceptions import (
5
  ServerException, TranslationNotFound)
6
 
 
40
  except Exception as e:
41
  raise e
42
 
43
+ def get_supported_languages(self, **kwargs):
44
+ # Have no use for this as the format is not what we need
45
+ # Save this for whenever
46
  pairs = self._get("get_languages")
47
+ # Using a this one instead
48
+ return QCRI_LANGUAGE_TO_CODE
49
 
50
  @property
51
  def languages(self):