Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#print "res: %s" % res
self.assertEqual (res, "'aIz@nba:n")
res = ipa2mary ("DIPHTONGTEST", u"aɪɔɪaʊɜ'")
#print "res: %s" % res
self.assertEqual (res, "aIOIaUr='")
res = ipa2mary ("BON", u"bɔ̃")
#print "res: %s" % res
self.assertEqual (res, "bO~")
res = ipa2mary ("RESTAURANT", u"ʁɛstɔʁɑ̃")
#print "res: %s" % res
self.assertEqual (res, "REstORA~")
res = ipa2mary ("VIN", u"vɛ̃")
#print "res: %s" % res
self.assertEqual (res, "vE~")
res = ipa2mary ("BRUN", u"bʁœ̃")
#print "res: %s" % res
self.assertEqual (res, "bR9~")
res = ipa2mary ("POIGNANT", u"pwaɲɑ̃")
#print "res: %s" % res
self.assertEqual (res, "pwaJA~")
res = xsampa2ipa(u"entrée A~ t R e", u"A~ t R e")
#print "res: %s" % res
self.assertEqual (res, u"ɑ̃tʁe")
#print "res: %s" % res
self.assertEqual (res, "aIOIaUr='")
res = ipa2mary ("BON", u"bɔ̃")
#print "res: %s" % res
self.assertEqual (res, "bO~")
res = ipa2mary ("RESTAURANT", u"ʁɛstɔʁɑ̃")
#print "res: %s" % res
self.assertEqual (res, "REstORA~")
res = ipa2mary ("VIN", u"vɛ̃")
#print "res: %s" % res
self.assertEqual (res, "vE~")
res = ipa2mary ("BRUN", u"bʁœ̃")
#print "res: %s" % res
self.assertEqual (res, "bR9~")
res = ipa2mary ("POIGNANT", u"pwaɲɑ̃")
#print "res: %s" % res
self.assertEqual (res, "pwaJA~")
res = xsampa2ipa(u"entrée A~ t R e", u"A~ t R e")
#print "res: %s" % res
self.assertEqual (res, u"ɑ̃tʁe")
#print "res: %s" % res
self.assertEqual (res, "vE~")
res = ipa2xsampa ("BRUN", u"bʁœ̃")
#print "res: %s" % res
self.assertEqual (res, "bR9~")
res = ipa2xsampa ("POIGNANT", u"pwaɲɑ̃")
#print "res: %s" % res
self.assertEqual (res, "pwaJA~")
res = ipa2mary ("EISENBAHN", u"ˈaɪ̯zən̩ˌbaːn")
#print "res: %s" % res
self.assertEqual (res, "'aIz@nba:n")
res = ipa2mary ("DIPHTONGTEST", u"aɪɔɪaʊɜ'")
#print "res: %s" % res
self.assertEqual (res, "aIOIaUr='")
res = ipa2mary ("BON", u"bɔ̃")
#print "res: %s" % res
self.assertEqual (res, "bO~")
res = ipa2mary ("RESTAURANT", u"ʁɛstɔʁɑ̃")
#print "res: %s" % res
self.assertEqual (res, "REstORA~")
res = ipa2mary ("VIN", u"vɛ̃")
#print "res: %s" % res
self.assertEqual (res, "vE~")
res = ipa2mary ("BRUN", u"bʁœ̃")
#print "res: %s" % res
self.assertEqual (res, "pwaJA~")
res = ipa2mary ("EISENBAHN", u"ˈaɪ̯zən̩ˌbaːn")
#print "res: %s" % res
self.assertEqual (res, "'aIz@nba:n")
res = ipa2mary ("DIPHTONGTEST", u"aɪɔɪaʊɜ'")
#print "res: %s" % res
self.assertEqual (res, "aIOIaUr='")
res = ipa2mary ("BON", u"bɔ̃")
#print "res: %s" % res
self.assertEqual (res, "bO~")
res = ipa2mary ("RESTAURANT", u"ʁɛstɔʁɑ̃")
#print "res: %s" % res
self.assertEqual (res, "REstORA~")
res = ipa2mary ("VIN", u"vɛ̃")
#print "res: %s" % res
self.assertEqual (res, "vE~")
res = ipa2mary ("BRUN", u"bʁœ̃")
#print "res: %s" % res
self.assertEqual (res, "bR9~")
res = ipa2mary ("POIGNANT", u"pwaɲɑ̃")
#print "res: %s" % res
self.assertEqual (res, "pwaJA~")
res = xsampa2ipa(u"entrée A~ t R e", u"A~ t R e")
#print "res: %s" % res
self.assertEqual (res, "bO~")
res = ipa2mary ("RESTAURANT", u"ʁɛstɔʁɑ̃")
#print "res: %s" % res
self.assertEqual (res, "REstORA~")
res = ipa2mary ("VIN", u"vɛ̃")
#print "res: %s" % res
self.assertEqual (res, "vE~")
res = ipa2mary ("BRUN", u"bʁœ̃")
#print "res: %s" % res
self.assertEqual (res, "bR9~")
res = ipa2mary ("POIGNANT", u"pwaɲɑ̃")
#print "res: %s" % res
self.assertEqual (res, "pwaJA~")
res = xsampa2ipa(u"entrée A~ t R e", u"A~ t R e")
#print "res: %s" % res
self.assertEqual (res, u"ɑ̃tʁe")
#print "res: %s" % res
self.assertEqual (res, "REstORA~")
res = ipa2xsampa ("VIN", u"vɛ̃")
#print "res: %s" % res
self.assertEqual (res, "vE~")
res = ipa2xsampa ("BRUN", u"bʁœ̃")
#print "res: %s" % res
self.assertEqual (res, "bR9~")
res = ipa2xsampa ("POIGNANT", u"pwaɲɑ̃")
#print "res: %s" % res
self.assertEqual (res, "pwaJA~")
res = ipa2mary ("EISENBAHN", u"ˈaɪ̯zən̩ˌbaːn")
#print "res: %s" % res
self.assertEqual (res, "'aIz@nba:n")
res = ipa2mary ("DIPHTONGTEST", u"aɪɔɪaʊɜ'")
#print "res: %s" % res
self.assertEqual (res, "aIOIaUr='")
res = ipa2mary ("BON", u"bɔ̃")
#print "res: %s" % res
self.assertEqual (res, "bO~")
res = ipa2mary ("RESTAURANT", u"ʁɛstɔʁɑ̃")
#print "res: %s" % res
self.assertEqual (res, "REstORA~")
res = ipa2mary ("VIN", u"vɛ̃")
def synthesize(self, txt, mode='txt'):
if self.host_tts == 'local':
wav = None
if self.engine == 'mary':
mary_set_voice (self.voice)
mary_set_locale (self.locale)
if mode == 'txt':
wav = mary_synth (txt)
elif mode == 'ipa':
xs = ipa2mary ('ipa', txt)
wav = mary_synth_phonemes (xs)
else:
raise Exception ("unknown mary mode '%s'" % mode)
elif self.engine == 'espeak':
if mode == 'txt':
self.espeak.voice = self.voice
wav = self.espeak.synth_wav (txt)
elif mode == 'ipa':
xs = ipa2xsampa ('ipa', txt)
logging.debug ('synthesize: %s %s -> %s' % (txt, mode, repr(xs)))
wav = self.espeak.synth_wav (xs, fmt='xs')
if self._host_tts == 'local':
# import pdb; pdb.set_trace()
wav = None
if self.engine == 'mary':
self.marytts.voice = self._voice
self.marytts.locale = self._locale
if mode == 'txt':
wav = self.marytts.synth_wav (txt)
elif mode == 'ipa':
xs = ipa2mary ('ipa', txt)
wav = self.marytts.synth_wav (xs, fmt='xs')
else:
raise Exception ("unknown mary mode '%s'" % mode)
elif self.engine == 'espeak':
if mode == 'txt':
self.espeak.voice = self._voice
self.espeak.speed = self._speed
self.espeak.pitch = self._pitch
wav = self.espeak.synth_wav (txt)
# logging.debug ('synthesize: %s %s -> %s' % (txt, mode, repr(wav)))
elif mode == 'ipa':
xs = ipa2xsampa ('ipa', txt)