Esempio n. 1
0
    def test_g2p(self):
        esng = ESpeakNG(voice='english-us')

        for g, xs_t, ipa_t in G2P_TESTS:

            xs = esng.g2p(g)
            self.assertEqual(xs, xs_t)

            ipa = esng.g2p(g, ipa=2)
            self.assertEqual(ipa, ipa_t)
outfn = '%s_extra' % options.lang

with codecs.open(outfn, 'w', 'utf8') as outf:

    for word in lex:

        cnt += 1

        if '_' in word:
            continue

        entry = lex[word]
        ipa1 = entry['ipa'].replace(u'-', u'').replace(u'ʔ', u'')
        es1 = ipa2espeak(word, ipa1, stress_to_vowels=True)
        es2 = esng.g2p(word)
        ipa2 = espeak2ipa(word, es2)
        es2 = ipa2espeak(word, ipa2, stress_to_vowels=True)

        if es1 == es2:
            logging.info(u'%6d/%6d [      MATCH] %s' % (cnt, len(lex), word))
            continue

        cnt_new += 1
        logging.info(u'%6d/%6d [new: %6d] %s -> %s : %s' %
                     (cnt, len(lex), cnt_new, word, es1, es2))

        outf.write(u'%s\t%s\n' % (word, es1))

        if DEBUG_LIMIT and cnt_new >= DEBUG_LIMIT:
            break
Esempio n. 3
0
a = isletool.LexicalTool('ISLEdict.txt')

sentence = "do you want another pumpkinseed"
phoneList = isletool.transcribe(a, sentence, 'longest')
print(phoneList)

from phonemizer.phonemize import phonemize

phonemize("hello", language='en-us', backend='espeak')
phonemize("hello my queen", language='en-us', backend='espeak')

phonemize("ich will", language='de', backend='espeak')

phonemize("bonjour le monde", language='fr-fr', backend='espeak')

phonemize("konnichiwa", language='japanese', backend='espeak')

phonemize("привет", language='ru', backend='espeak')
phonemize("salam", language='fa', backend='espeak')
phonemize("انتساب", language='fa', backend='espeak')
phonemize("انتساب", language='fa-latn', backend='espeak')

from espeakng import ESpeakNG

esng = ESpeakNG()

esng.g2p('Hello World!', ipa=2)

from g2p import make_g2p