cloudlanguagetools 11.4.0__tar.gz → 11.5.0__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/PKG-INFO +1 -1
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/azure.py +22 -12
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/PKG-INFO +1 -1
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/setup.py +1 -1
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_audio.py +9 -3
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_translation.py +30 -3
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/LICENSE +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/README.rst +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/__init__.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/amazon.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/argostranslate.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/audio_processing.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/cereproc.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/chatapi.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/constants.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/deepl.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/dictionarylookup.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/easypronunciation.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/elevenlabs.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/encryption.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/epitran.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/errors.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/forvo.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/fptai.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/google.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/keys.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/languages.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/libretranslate.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/mandarincantonese.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/naver.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/openai.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/options.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/pythainlp.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/service.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/servicemanager.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/spacy.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/test_services.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/tokenization.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/translationlanguage.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/transliterationlanguage.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/ttsvoice.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/vocalware.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/voicen.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/watson.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/wenlin.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/SOURCES.txt +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/dependency_links.txt +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/requires.txt +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/top_level.txt +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/setup.cfg +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_breakdown.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_chatapi.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_dictionary_lookup.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_llm.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_mock_services.py +0 -0
- {cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/tests/test_servicemanager.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cloudlanguagetools
|
3
|
-
Version: 11.
|
3
|
+
Version: 11.5.0
|
4
4
|
Summary: Interface with various cloud APIs for language processing such as translation, text to speech
|
5
5
|
Home-page: https://github.com/Language-Tools/cloud-language-tools-core
|
6
6
|
Author: Luc
|
@@ -186,7 +186,7 @@ class AzureTranslationLanguage(cloudlanguagetools.translationlanguage.Translatio
|
|
186
186
|
return self.language_id
|
187
187
|
|
188
188
|
class AzureTransliterationLanguage(cloudlanguagetools.transliterationlanguage.TransliterationLanguage):
|
189
|
-
def __init__(self, language_id, from_script, to_script, from_script_name, to_script_name):
|
189
|
+
def __init__(self, language_id, from_script, to_script, from_script_name, to_script_name, from_native_name, to_native_name):
|
190
190
|
self.service = cloudlanguagetools.constants.Service.Azure
|
191
191
|
self.service_fee = cloudlanguagetools.constants.ServiceFee.paid
|
192
192
|
self.language_id = language_id
|
@@ -195,13 +195,15 @@ class AzureTransliterationLanguage(cloudlanguagetools.transliterationlanguage.Tr
|
|
195
195
|
self.to_script = to_script
|
196
196
|
self.from_script_name = from_script_name
|
197
197
|
self.to_script_name = to_script_name
|
198
|
+
self.from_native_name = from_native_name
|
199
|
+
self.to_native_name = to_native_name
|
198
200
|
|
199
201
|
def get_transliteration_name(self):
|
200
|
-
result = f'{self.language.lang_name} ({self.from_script_name} to {self.to_script_name}), {self.service.name}'
|
202
|
+
result = f'{self.language.lang_name} ({self.from_script_name}/{self.from_native_name} to {self.to_script_name}/{self.to_native_name}), {self.service.name}'
|
201
203
|
return result
|
202
204
|
|
203
205
|
def get_transliteration_shortname(self):
|
204
|
-
result = f'{self.from_script_name} to {self.to_script_name}, {self.service.name}'
|
206
|
+
result = f'{self.from_script_name}/{self.from_native_name} to {self.to_script_name}/{self.to_native_name}, {self.service.name}'
|
205
207
|
return result
|
206
208
|
|
207
209
|
def get_transliteration_key(self):
|
@@ -402,16 +404,24 @@ class AzureService(cloudlanguagetools.service.Service):
|
|
402
404
|
result = []
|
403
405
|
azure_data = self.get_supported_languages()
|
404
406
|
for language_id, data in azure_data['transliteration'].items():
|
405
|
-
# get the first script
|
406
|
-
first_script = data['scripts'][0]
|
407
|
-
from_script = first_script['code']
|
408
|
-
to_script = first_script['toScripts'][0]['code']
|
409
|
-
from_script_name = first_script['name']
|
410
|
-
to_script_name = first_script['toScripts'][0]['name']
|
411
|
-
# print(language_id, from_script, to_script)
|
412
|
-
# assert(to_script == 'Latn')
|
413
407
|
try:
|
414
|
-
|
408
|
+
# get the first script
|
409
|
+
for from_script_data in data['scripts']:
|
410
|
+
from_script = from_script_data['code']
|
411
|
+
from_native_name = from_script_data['nativeName']
|
412
|
+
for to_script_data in from_script_data['toScripts']:
|
413
|
+
to_script = to_script_data['code']
|
414
|
+
from_script_name = from_script_data['name']
|
415
|
+
to_script_name = to_script_data['name']
|
416
|
+
to_native_name = to_script_data['nativeName']
|
417
|
+
result.append(AzureTransliterationLanguage(
|
418
|
+
language_id,
|
419
|
+
from_script,
|
420
|
+
to_script,
|
421
|
+
from_script_name,
|
422
|
+
to_script_name,
|
423
|
+
from_native_name,
|
424
|
+
to_native_name))
|
415
425
|
except KeyError:
|
416
426
|
logging.error(f'could not process transliteration language for {language_id}, {data}', exc_info=True)
|
417
427
|
return result
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/PKG-INFO
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: cloudlanguagetools
|
3
|
-
Version: 11.
|
3
|
+
Version: 11.5.0
|
4
4
|
Summary: Interface with various cloud APIs for language processing such as translation, text to speech
|
5
5
|
Home-page: https://github.com/Language-Tools/cloud-language-tools-core
|
6
6
|
Author: Luc
|
@@ -6,7 +6,7 @@ from setuptools.command.install import install
|
|
6
6
|
# twine upload dist/*
|
7
7
|
|
8
8
|
setup(name='cloudlanguagetools',
|
9
|
-
version='11.
|
9
|
+
version='11.5.0',
|
10
10
|
description='Interface with various cloud APIs for language processing such as translation, text to speech',
|
11
11
|
long_description=open('README.rst', encoding='utf-8').read(),
|
12
12
|
url='https://github.com/Language-Tools/cloud-language-tools-core',
|
@@ -143,6 +143,11 @@ class TestAudio(unittest.TestCase):
|
|
143
143
|
# logging.info(f'verify_service_audio: service: {service} audio_language: {audio_language}')
|
144
144
|
voices = self.get_voice_list_service_audio_language(service, audio_language)
|
145
145
|
self.assertGreaterEqual(len(voices), 1, f'at least one voice for service {service}, language {audio_language}')
|
146
|
+
|
147
|
+
if service == Service.Google:
|
148
|
+
# exclude Journey voices, they don't use the standard interface
|
149
|
+
voices = [x for x in voices if 'Journey' not in x['voice_name']]
|
150
|
+
|
146
151
|
# pick 3 random voices
|
147
152
|
max_voices = 3
|
148
153
|
if len(voices) > max_voices:
|
@@ -179,7 +184,8 @@ class TestAudio(unittest.TestCase):
|
|
179
184
|
# pprint.pprint(mandarin_azure_voices)
|
180
185
|
|
181
186
|
xiaochen = [x for x in mandarin_azure_voices if 'Xiaochen' in x.name]
|
182
|
-
self.
|
187
|
+
self.assertEqual(len(xiaochen), 3, str(xiaochen)) # there is a regular and a multilingual
|
188
|
+
# and also a DragonHD
|
183
189
|
|
184
190
|
xiaochen_single_language = [x for x in xiaochen if len(x.audio_languages) == 1][0]
|
185
191
|
self.assertEquals(xiaochen_single_language.audio_languages, [AudioLanguage.zh_CN])
|
@@ -257,7 +263,7 @@ class TestAudio(unittest.TestCase):
|
|
257
263
|
mandarin_azure_voices = [x for x in azure_voices if AudioLanguage.zh_CN in x.audio_languages]
|
258
264
|
|
259
265
|
xiaochen = [x for x in mandarin_azure_voices if 'Xiaochen' in x.name]
|
260
|
-
self.
|
266
|
+
self.assertEqual(len(xiaochen), 3) # there is a regular and a multilingual, and dragonhd
|
261
267
|
|
262
268
|
xiaochen_single_language = [x for x in xiaochen if len(x.audio_languages) == 1][0]
|
263
269
|
xiaochen_multilingual = [x for x in xiaochen if len(x.audio_languages) > 1][0]
|
@@ -526,7 +532,7 @@ class TestAudio(unittest.TestCase):
|
|
526
532
|
|
527
533
|
def test_google_format_wav(self):
|
528
534
|
fr_voice = self.get_voice_by_lambda(Service.Google,
|
529
|
-
lambda x: AudioLanguage.fr_FR in x.audio_languages, assert_unique=False)
|
535
|
+
lambda x: AudioLanguage.fr_FR in x.audio_languages and 'Journey' not in x.name, assert_unique=False)
|
530
536
|
self.verify_wav_voice(fr_voice, self.FRENCH_INPUT_TEXT, 'fr-FR')
|
531
537
|
|
532
538
|
def test_naver_format_wav(self):
|
@@ -226,14 +226,41 @@ class TestTranslation(unittest.TestCase):
|
|
226
226
|
self.assertTrue
|
227
227
|
self.assertEqual(result['Watson'], "<b><span style=\"font-weight: 400;\">What's wrong with you?</span></b>")
|
228
228
|
|
229
|
-
def
|
230
|
-
# pytest test_translation.py -k
|
229
|
+
def test_transliteration_azure_custom(self):
|
230
|
+
# pytest tests/test_translation.py -k test_transliteration_azure_custom
|
231
|
+
|
232
|
+
# chinese
|
233
|
+
source_text = '成本很低'
|
234
|
+
service = 'Azure'
|
235
|
+
# transliteration_key = transliteration_option['transliteration_key']
|
236
|
+
transliteration_key = {
|
237
|
+
'language_id': 'zh-Hans',
|
238
|
+
'from_script': 'Hans',
|
239
|
+
'to_script': 'Latn',
|
240
|
+
}
|
241
|
+
result = self.manager.get_transliteration(source_text, service, transliteration_key)
|
242
|
+
self.assertIn(result, ['chéng běn hěn dī', 'chéngběn hěndī'])
|
243
|
+
|
244
|
+
transliteration_key = {
|
245
|
+
'language_id': 'zh-Hant',
|
246
|
+
'from_script': 'Hans',
|
247
|
+
'to_script': 'Hant',
|
248
|
+
}
|
249
|
+
result = self.manager.get_transliteration('讲话', service, transliteration_key)
|
250
|
+
self.assertEqual(result, '講話')
|
251
|
+
|
252
|
+
def test_transliteration_azure(self):
|
253
|
+
# pytest tests/test_translation.py -k test_transliteration_azure
|
231
254
|
|
232
255
|
# chinese
|
233
256
|
source_text = '成本很低'
|
234
257
|
from_language = Language.zh_cn.name
|
235
258
|
service = 'Azure'
|
236
|
-
transliteration_candidates = [
|
259
|
+
transliteration_candidates = [
|
260
|
+
x for x in self.transliteration_language_list
|
261
|
+
if x['language_code'] == from_language
|
262
|
+
and x['service'] == service
|
263
|
+
and 'to Latin' in x['transliteration_shortname']]
|
237
264
|
self.assertTrue(len(transliteration_candidates) == 1)
|
238
265
|
transliteration_option = transliteration_candidates[0]
|
239
266
|
service = transliteration_option['service']
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/argostranslate.py
RENAMED
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/audio_processing.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/dictionarylookup.py
RENAMED
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/easypronunciation.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/libretranslate.py
RENAMED
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/mandarincantonese.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/servicemanager.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools/translationlanguage.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/SOURCES.txt
RENAMED
File without changes
|
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/requires.txt
RENAMED
File without changes
|
{cloudlanguagetools-11.4.0 → cloudlanguagetools-11.5.0}/cloudlanguagetools.egg-info/top_level.txt
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|