def test_drop_apostrophe(self):
     self.assertEqual(trans.pinyin_to_zhuyin("xi1'an1"), "ㄒㄧ ㄢ")
     self.assertEqual(trans.pinyin_to_ipa("xi1'an1"), "ɕi˥ an˥")
     self.assertEqual(trans.to_pinyin("xi1'an1"), "xī'ān")
     self.assertEqual(trans.pinyin_to_zhuyin("xī'ān"), "ㄒㄧ ㄢ")
     self.assertEqual(trans.pinyin_to_ipa("xī'ān"), "ɕi˥ an˥")
     self.assertEqual(trans.to_pinyin("xī'ān", accented=False), "xi1'an1")
Esempio n. 2
0
 def test_drop_apostrophe(self):
     self.assertEqual(trans.pinyin_to_zhuyin("xi1'an1"), 'ㄒㄧ ㄢ')
     self.assertEqual(trans.pinyin_to_ipa("xi1'an1"), 'ɕi˥ an˥')
     self.assertEqual(trans.to_pinyin("xi1'an1"), "xī'ān")
     self.assertEqual(trans.pinyin_to_zhuyin("xī'ān"), 'ㄒㄧ ㄢ')
     self.assertEqual(trans.pinyin_to_ipa("xī'ān"), 'ɕi˥ an˥')
     self.assertEqual(trans.to_pinyin("xī'ān", accented=False), "xi1'an1")
    def test_issue_6(self):
        pinyin = "zhuójìnr"
        zhuyin = "ㄓㄨㄛˊ ㄐㄧㄣˋ ㄦ˙"
        ipa = "ʈʂwɔ˧˥ tɕin˥˩ ɻ"

        self.assertEqual(zhuyin, trans.pinyin_to_zhuyin(pinyin))
        self.assertEqual(ipa, trans.pinyin_to_ipa(pinyin))
Esempio n. 4
0
    def test_issue_6(self):
        pinyin = 'zhuójìnr'
        zhuyin = 'ㄓㄨㄛˊ ㄐㄧㄣˋ ㄦ˙'
        ipa = 'ʈʂwɔ˧˥ tɕin˥˩ ɻ'

        self.assertEqual(zhuyin, trans.pinyin_to_zhuyin(pinyin))
        self.assertEqual(ipa, trans.pinyin_to_ipa(pinyin))
Esempio n. 5
0
    def test_issue_6(self):
        pinyin = 'zhuójìnr'
        zhuyin = 'ㄓㄨㄛˊ ㄐㄧㄣˋ ㄦ˙'
        ipa = 'ʈʂwɔ˧˥ tɕin˥˩ ɻ'

        self.assertEqual(zhuyin, trans.pinyin_to_zhuyin(pinyin))
        self.assertEqual(ipa, trans.pinyin_to_ipa(pinyin))
Esempio n. 6
0
def to_ipa(s, delimiter=' ', all_readings=False, container='[]'):
    """Convert a string's Chinese characters to IPA.

    *s* is a string containing Chinese characters.

    *delimiter* is the character used to indicate word boundaries in *s*.
    This is used to differentiate between words and characters so that a more
    accurate reading can be returned.

    *all_readings* is a boolean value indicating whether or not to return all
    possible readings in the case of words/characters that have multiple
    readings. *container* is a two character string that is used to
    enclose words/characters if *all_readings* is ``True``. The default
    ``'[]'`` is used like this: ``'[READING1/READING2]'``.

    Characters not recognized as Chinese are left untouched.

    """
    numbered_pinyin = to_pinyin(s, delimiter, all_readings, container, False)
    ipa = pinyin_to_ipa(numbered_pinyin)
    return ipa
Esempio n. 7
0
def to_ipa(s, delimiter=' ', all_readings=False, container='[]'):
    """Convert a string's Chinese characters to IPA.

    *s* is a string containing Chinese characters.

    *delimiter* is the character used to indicate word boundaries in *s*.
    This is used to differentiate between words and characters so that a more
    accurate reading can be returned.

    *all_readings* is a boolean value indicating whether or not to return all
    possible readings in the case of words/characters that have multiple
    readings. *container* is a two character string that is used to
    enclose words/characters if *all_readings* is ``True``. The default
    ``'[]'`` is used like this: ``'[READING1/READING2]'``.

    Characters not recognized as Chinese are left untouched.

    """
    numbered_pinyin = to_pinyin(s, delimiter, all_readings, container, False)
    ipa = pinyin_to_ipa(numbered_pinyin)
    return ipa
 def test_pinyin_to_ipa(self):
     self.assertEqual(trans.pinyin_to_ipa(self.accented_pinyin), self.ipa)
     self.assertEqual(trans.pinyin_to_ipa(self.numbered_pinyin), self.ipa)
Esempio n. 9
0
 def test_pinyin_to_ipa(self):
     self.assertEqual(trans.pinyin_to_ipa(self.accented_pinyin), self.ipa)
     self.assertEqual(trans.pinyin_to_ipa(self.numbered_pinyin), self.ipa)