import os\r
import sys\r
sys.path.append(r'..\source\synthDrivers\jtalk')\r
-from _jtalk_core import *\r
from _nvdajp_unicode import unicode_normalize\r
-import _nvdajp_predic\r
+import jtalkPrepare\r
\r
tests = [\r
['ー', 'チョーオン'],\r
def _print(s):\r
print(s.encode('utf-8', 'ignore'))\r
\r
-if __name__ == '__main__':\r
- _nvdajp_predic.setup()\r
+def runTasks():\r
+ jtalkPrepare.setup()\r
+ count = 0\r
for item in tests:\r
msg = item[0]\r
msg = unicode_normalize(msg)\r
- s = _nvdajp_predic.convert(msg)\r
+ s = jtalkPrepare.convert(msg)\r
if item[1] != s:\r
_print('expected:%s result:%s' % (item[1], s))\r
+ count += 1\r
+ return count\r
+\r
+if __name__ == '__main__':\r
+ runTasks()\r
stream.close()
p.terminate()
+do_print = False
+
def __print(s):
- print(s.encode('cp932', 'ignore'))
+ if do_print:
+ print(s.encode('cp932', 'ignore'))
def print_code(msg):
s = ''
s = msgs[0]
fperiod = v['fperiod']
do_synthesis(s, v, do_play, do_write, do_log, fperiod, pitch=50, inflection=50)
+ return 0
if __name__ == '__main__':
+ do_print = True
main(do_play=False, do_write=True)
#prof = cProfile.run("main(do_play=True)", '_cprof.prof')
#p = pstats.Stats('_cprof.prof')
mf = None\r
return reading\r
\r
-if __name__ == '__main__':\r
+def runTasks(enableUserDic=False):\r
print jt_dir, dic, user_dics_org, user_dics\r
- Mecab_initialize(__print, jt_dir, dic, user_dics)\r
+ if enableUserDic:\r
+ Mecab_initialize(__print, jt_dir, dic, user_dics)\r
+ else:\r
+ Mecab_initialize(__print, jt_dir, dic)\r
+ count = 0\r
for i in tasks:\r
if isinstance(i, dict):\r
if 'braille' in i:\r
__print('input: ' + item[0])\r
__print('reading expected: ' + item[1])\r
__print('reading result: ' + result[0])\r
+ count += 1\r
if len(item) > 2 and result[1] != item[2]:\r
__print('')\r
__print('')\r
__print('input: ' + item[0])\r
__print('braille expected: ' + item[2])\r
__print('braille result: ' + result[1])\r
+ count += 1\r
+\r
+ return count\r
\r
- \r
+if __name__ == '__main__':\r
+ runTasks(enableUserDic=True)\r
+call userdicBuilder.cmd
python test.py
import unittest
import jpBrailleRunner
+import mecabRunner
+import jtalkPredicTest
+import jtalkRunner
class JpBrailleTests(unittest.TestCase):
count, outfile = jpBrailleRunner.pass2()
self.assertEqual(count, 0)
+class MecabTests(unittest.TestCase):
+
+ def test_all(self):
+ count = mecabRunner.runTasks()
+ self.assertEqual(count, 0)
+
+class JtalkPrepareTests(unittest.TestCase):
+
+ def test_all(self):
+ count = jtalkPredicTest.runTasks()
+ self.assertEqual(count, 0)
+
+class JtalkTests(unittest.TestCase):
+
+ def test_jtalk(self):
+ ret = jtalkRunner.main(do_play=False, do_write=False, do_log=False)
+ self.assertEqual(ret, 0)
+
if __name__ == '__main__':
unittest.main()