Example #1
0
    def test_pause_in_words(self):
        pause_line = '\n    0.44  121 <SIL>; S; S; null'
        with_pause_entry = pause_line.join([WORDS[:44], WORDS[82:]])
        words_paused = list(process_words(io.StringIO(with_pause_entry)))

        assert_equal(words_paused[1].beg, 0.15)
        assert_equal(words_paused[1].end, 0.44)
        assert_equal(words_paused[1].entry, '<SIL>')
Example #2
0
    def test_pause_in_words(self):
        pause_line = '\n    0.44  121 <SIL>; S; S; null'
        with_pause_entry = pause_line.join([WORDS[:44], WORDS[82:]])
        words_paused = list(process_words(io.StringIO(with_pause_entry)))

        assert_equal(words_paused[1].beg, 0.15)
        assert_equal(words_paused[1].end, 0.44)
        assert_equal(words_paused[1].entry, '<SIL>')
Example #3
0
    def test_three_fields(self):
        lines = 'header\n#\n0.15  121 the; dh iy; DT\n'
        three_field_word = next(process_words(io.StringIO(lines)))

        assert_equal(three_field_word.beg, 0.0)
        assert_equal(three_field_word.end, 0.15)
        assert_equal(three_field_word.orthography, 'the')
        assert_equal(three_field_word.phonemic, ['dh', 'iy'])
        assert_equal(three_field_word.phonetic, None)
        assert_equal(three_field_word.pos, 'DT')
Example #4
0
    def test_three_fields(self):
        lines = 'header\n#\n0.15  121 the; dh iy; DT\n'
        three_field_word = next(process_words(io.StringIO(lines)))

        assert_equal(three_field_word.beg, 0.0)
        assert_equal(three_field_word.end, 0.15)
        assert_equal(three_field_word.orthography, 'the')
        assert_equal(three_field_word.phonemic, ['dh', 'iy'])
        assert_equal(three_field_word.phonetic, None)
        assert_equal(three_field_word.pos, 'DT')
Example #5
0
    def test_blank_line_in_entry(self):
        with_spaced_entry = '\n\n'.join([WORDS[:44], WORDS[44:]])
        words_spaced = list(process_words(io.StringIO(with_spaced_entry)))

        yield self.check_expected, words_spaced
Example #6
0
    def test_blank_line_in_header(self):
        with_spaced_header = '\n\n'.join([WORDS[:8], WORDS[8:]])
        words_spaced = list(process_words(io.StringIO(with_spaced_header)))

        yield self.check_expected, words_spaced
Example #7
0
 def test_process_empty_words(self):
     no_entries = io.StringIO('header#\n\n\n')
     list(process_words(no_entries))
Example #8
0
 def test_process_blank_words(self):
     blank_wordsfile = io.StringIO('\n\n\n\n')
     list(process_words(blank_wordsfile))
Example #9
0
    def test_process_words(self):
        words = list(process_words(io.StringIO(WORDS)))

        yield self.check_expected, words
Example #10
0
    def test_blank_line_in_entry(self):
        with_spaced_entry = '\n\n'.join([WORDS[:44], WORDS[44:]])
        words_spaced = list(process_words(io.StringIO(with_spaced_entry)))

        yield self.check_expected, words_spaced
Example #11
0
    def test_blank_line_in_header(self):
        with_spaced_header = '\n\n'.join([WORDS[:8], WORDS[8:]])
        words_spaced = list(process_words(io.StringIO(with_spaced_header)))

        yield self.check_expected, words_spaced
Example #12
0
 def test_process_empty_words(self):
     no_entries = io.StringIO('header#\n\n\n')
     list(process_words(no_entries))
Example #13
0
 def test_process_blank_words(self):
     blank_wordsfile = io.StringIO('\n\n\n\n')
     list(process_words(blank_wordsfile))
Example #14
0
    def test_process_words(self):
        words = list(process_words(io.StringIO(WORDS)))

        yield self.check_expected, words