espeak.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:anorack 作者: jwilk 项目源码 文件源码
def text_to_phonemes(s, *, ipa=False):
        '''
        translate text to phonemes
        '''
        s = s.encode('UTF-8')
        z = ctypes.c_char_p(s)
        zptr = ctypes.pointer(z)
        assert zptr.contents is not None
        if version >= '1.48.11':
            ipa = ipa << 1  # no coverage
        else:
            ipa = ipa << 4
        res = _text_to_phonemes(zptr, 1, ipa)
        if zptr.contents.value is not None:
            raise RuntimeError  # no coverage
        return res.decode('UTF-8').strip()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号