File: test_hypseg.py

package info (click to toggle)
sphinxtrain 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32,572 kB
  • sloc: ansic: 94,052; perl: 8,939; python: 6,702; cpp: 2,044; makefile: 6
file content (23 lines) | stat: -rw-r--r-- 651 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python

import unittest
from cmusphinx import hypseg
import os


class TestHypseg(unittest.TestCase):
    def setUp(self):
        thisdir = os.path.dirname(__file__)
        self.testdir = os.path.join(thisdir, 'data')

    def test_read(self):
        hseg = hypseg.open(os.path.join(self.testdir, "an4-1-1.matchseg"))
        for spam in hseg:
            self.assertTrue(spam.uttid.startswith("an4test"))
        with hypseg.open(os.path.join(self.testdir, "an4-1-1.matchseg")) as hseg:
            for spam in hseg:
                self.assertTrue(spam.uttid.startswith("an4test"))


if __name__ == '__main__':
    unittest.main()