Example #1
0
    def test_strip_pause_only(self):
        pause = Pause(beg=1.25, end=1.95)
        utt_strip = Utterance([pause])

        utt_strip.strip()

        assert_equal(utt_strip.words(), [])
Example #2
0
 def test_strip_pause_only(self):
     pause = Pause(beg=1.25, end=1.95)
     utt_strip = Utterance([pause])
     
     utt_strip.strip()
     
     assert_equal(utt_strip.words(), [])
Example #3
0
    def test_strip_end_zero(self):
        zero = Word('', 1.25, 1.25)
        utt_strip = Utterance(self.words + [zero])

        utt_strip.strip()

        assert_not_in(zero, utt_strip)
        assert_equal(utt_strip.words(), self.words)
Example #4
0
    def test_strip_beg_zero(self):
        zero = Word('', 0.0, 0.0)
        utt_strip = Utterance([zero] + self.words)

        utt_strip.strip()

        assert_not_in(zero, utt_strip)
        assert_equal(utt_strip.words(), self.words)
Example #5
0
    def test_strip_end_pause(self):
        pause = Pause(beg=1.25, end=1.85)
        utt_strip = Utterance(self.words + [pause])

        utt_strip.strip()

        assert_not_in(pause, utt_strip)
        assert_equal(utt_strip.words(), self.words)
Example #6
0
    def test_strip_beg_pause(self):
        pause = Pause(beg=0, end=0.55)
        utt_strip = Utterance([pause] + self.words[3:])

        utt_strip.strip()

        assert_not_in(pause, utt_strip)
        assert_equal(utt_strip.words(), self.words[3:])
Example #7
0
    def test_strip_end_zero(self):
        zero = Word('', 1.25, 1.25)
        utt_strip = Utterance(self.words + [zero])

        utt_strip.strip()

        assert_not_in(zero, utt_strip)
        assert_equal(utt_strip.words(), self.words)
Example #8
0
    def test_strip_beg_zero(self):
        zero = Word('', 0.0, 0.0)
        utt_strip = Utterance([zero] + self.words)

        utt_strip.strip()

        assert_not_in(zero, utt_strip)
        assert_equal(utt_strip.words(), self.words)
Example #9
0
    def test_strip_end_pause(self):
        pause = Pause(beg=1.25, end=1.85)
        utt_strip = Utterance(self.words + [pause])

        utt_strip.strip()

        assert_not_in(pause, utt_strip)
        assert_equal(utt_strip.words(), self.words)
Example #10
0
    def test_strip_beg_pause(self):
        pause = Pause(beg=0, end=0.55)
        utt_strip = Utterance([pause] + self.words[3:])

        utt_strip.strip()

        assert_not_in(pause, utt_strip)
        assert_equal(utt_strip.words(), self.words[3:])
Example #11
0
    def test_strip_end_multiple(self):
        pause = Pause(beg=1.25, end=1.95)
        zero = Word('', 1.95, 1.95)
        utt_strip = Utterance()
        utt_strip._words = self.words + [pause, zero]

        utt_strip.strip()

        for entry in {pause, zero}:
            assert_not_in(entry, utt_strip)

        assert_equal(utt_strip.words(), self.words)
Example #12
0
    def test_strip_beg_multiple(self):
        pause = Pause(beg=0, end=0.39)
        zero = Word('', 0.39, 0.39)
        utt_strip = Utterance()
        utt_strip._words = [pause, zero] + self.words[2:]

        utt_strip.strip()

        for entry in {pause, zero}:
            assert_not_in(entry, utt_strip)

        assert_equal(utt_strip.words(), self.words[2:])
Example #13
0
    def test_strip_end_multiple(self):
        pause = Pause(beg=1.25, end=1.95)
        zero = Word('', 1.95, 1.95)
        utt_strip = Utterance()
        utt_strip._words = self.words + [pause, zero]

        utt_strip.strip()

        for entry in {pause, zero}:
            assert_not_in(entry, utt_strip)

        assert_equal(utt_strip.words(), self.words)
Example #14
0
    def test_strip_beg_multiple(self):
        pause = Pause(beg=0, end=0.39)
        zero = Word('', 0.39, 0.39)
        utt_strip = Utterance()
        utt_strip._words = [pause, zero] + self.words[2:]
        
        utt_strip.strip()
        
        for entry in {pause, zero}:
            assert_not_in(entry, utt_strip)

        assert_equal(utt_strip.words(), self.words[2:])