示例#1
0
    def test_phones_setter(self):
        assert_false(self.word.misaligned)

        phone_th = Phone('th')
        phone_dh = Phone('dh')

        self.word._phones = [phone_th]
        assert_in(phone_th, self.word.phones)
        assert_true(self.word.misaligned)

        self.word._phones = [phone_dh]
        assert_in(phone_dh, self.word.phones)
        assert_false(self.word.misaligned)

        self.word._phones = []
        assert_true(self.word.misaligned)
示例#2
0
    def test_misaligned(self):
        misaligned_word = Word('', 0.50, 0.25)
        assert_true(misaligned_word.misaligned)

        phone_dh = Phone('dh')
        misaligned_word._phones = [phone_dh]
        assert_true(misaligned_word.misaligned)
示例#3
0
    def test_empty_phone(self):
        empty_phone = Phone('th')

        assert_equal(empty_phone.seg, 'th')
        assert_is_none(empty_phone.beg)
        assert_is_none(empty_phone.end)
        assert_raises(AttributeError, getattr, empty_phone, 'dur')
示例#4
0
    def test_misaligned(self):
        misaligned_pause = Pause('', 0.50, 0.25)
        assert_true(misaligned_pause.misaligned)

        phone_sil = Phone('SIL')
        misaligned_pause._phones = [phone_sil]
        assert_true(misaligned_pause.misaligned)
示例#5
0
    def test_syllables_phones(self):
        word = Word('the', 0.05, 0.25, ['dh', 'iy'], ['dh'], 'DT')
        word._phones = [Phone('dh')]

        assert_equal(word.syllables(), 1)
        assert_equal(word.syllables(phonetic=False), 1)
        assert_equal(word.syllables(phonetic=True), 0)
示例#6
0
    def test_phones_setter(self):
        assert_false(self.pause.misaligned)

        phone_sil = Phone('SIL')

        self.pause._phones = [phone_sil]
        assert_in(phone_sil, self.pause.phones)
        assert_false(self.pause.misaligned)

        self.pause._phones = []
        assert_false(self.pause.misaligned)
示例#7
0
 def test_phone_missing(self):
     phone = Phone()
示例#8
0
 def setup(self):
     self.phone = Phone('dh', 0.05, 0.15)
示例#9
0
 def test_misaligned_different_length_phonetic_and_phones(self):
     misaligned_word = Word('', 0.25, 0.50, phonetic=['dh', 'ah'])
     misaligned_word._phones = [Phone('dh')]
     assert_true(misaligned_word.misaligned)
示例#10
0
 def test_misaligned_missing_phonetic_with_phones(self):
     misaligned_word = Word('', 0.25, 0.50, phonetic=None)
     misaligned_word._phones = [Phone('dh')]
     assert_true(misaligned_word.misaligned)
示例#11
0
 def test_misaligned_backwards(self):
     misaligned_word = Word('', 0.50, 0.25, phonetic=['dh'])
     misaligned_word._phones = [Phone('dh')]
     assert_true(misaligned_word.misaligned)