Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_arabic():
backend = EspeakBackend('ar')
text = u'السلام عليكم'
sep = separator.Separator()
# Arabic seems to have changed starting at espeak-ng-1.49.3
if tuple(EspeakBackend.version().split('.')) >= ('1', '49', '3'):
expected = [u'ʔassalaːm ʕliːkm ']
else:
expected = [u'ʔassalaam ʕaliijkum ']
out = backend._phonemize_aux(text, sep, False)
assert out == expected
def version():
"""Return version information for front and backends"""
# version of the phonemizer
version = (
'phonemizer-' + pkg_resources.get_distribution('phonemizer').version)
# for each backend, check if it is available or not. If so get its version
available = []
unavailable = []
if EspeakBackend.is_available():
available.append(
'espeak-' + ('ng-' if EspeakBackend.is_espeak_ng() else '')
+ EspeakBackend.version())
else: # pragma: nocover
unavailable.append('espeak')
if FestivalBackend.is_available():
available.append('festival-' + FestivalBackend.version())
else: # pragma: nocover
unavailable.append('festival')
if SegmentsBackend.is_available():
available.append('segments-' + SegmentsBackend.version())
else: # pragma: nocover
unavailable.append('segments')
# resumes the backends status in the final version string
if available:
version += '\navailable backends: ' + ', '.join(available)