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()
|