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)
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)
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')
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)
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)
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)
def test_phone_missing(self): phone = Phone()
def setup(self): self.phone = Phone('dh', 0.05, 0.15)
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)
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)
def test_misaligned_backwards(self): misaligned_word = Word('', 0.50, 0.25, phonetic=['dh']) misaligned_word._phones = [Phone('dh')] assert_true(misaligned_word.misaligned)