How to use the nltools.phonetics.ipa2mary function in nltools

To help you get started, we’ve selected a few nltools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gooofy / py-nltools / tests / test_phonetics.py View on Github external
#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")
github gooofy / py-nltools / tests / test_phonetics.py View on Github external
#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")
github gooofy / py-nltools / tests / test_phonetics.py View on Github external
#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ʁœ̃")
github gooofy / py-nltools / tests / test_phonetics.py View on Github external
#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")
github gooofy / py-nltools / tests / test_phonetics.py View on Github external
#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")
github gooofy / py-nltools / tests / test_phonetics.py View on Github external
#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ɛ̃")
github gooofy / py-nltools / nltools / tts_client.py View on Github external
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')
github gooofy / py-nltools / nltools / tts.py View on Github external
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)