File size: 867 Bytes
45ee559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import unittest

from TTS.tts.utils.text.japanese.phonemizer import japanese_text_to_phonemes

_TEST_CASES = """
ใฉใกใ‚‰ใซ่กŒใใพใ™ใ‹๏ผŸ/dochiraniikimasuka?
ไปŠๆ—ฅใฏๆธฉๆณ‰ใซใ€่กŒใใพใ™ใ€‚/kyo:waoNseNni,ikimasu.
ใ€ŒAใ€ใ‹ใ‚‰ใ€ŒZใ€ใพใงใงใ™ใ€‚/e:karazeqtomadedesu.
ใใ†ใงใ™ใญ๏ผ/so:desune!
ใ‚ฏใ‚ธใƒฉใฏๅ“บไนณ้กžใงใ™ใ€‚/kujirawahonyu:ruidesu.
ใƒดใ‚ฃใƒ‡ใ‚ฃใ‚ชใ‚’่ฆ‹ใพใ™ใ€‚/bidioomimasu.
ไปŠๆ—ฅใฏ๏ผ˜ๆœˆ22ๆ—ฅใงใ™/kyo:wahachigatsuniju:ninichidesu
xyzใจฮฑฮฒฮณ/eqkusuwaizeqtotoarufabe:tagaNma
ๅ€คๆฎตใฏ$12.34ใงใ™/nedaNwaju:niteNsaNyoNdorudesu
"""


class TestText(unittest.TestCase):
    def test_japanese_text_to_phonemes(self):
        for line in _TEST_CASES.strip().split("\n"):
            text, phone = line.split("/")
            self.assertEqual(japanese_text_to_phonemes(text), phone)


if __name__ == "__main__":
    unittest.main()