-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun_wer_test.py
34 lines (24 loc) · 1.1 KB
/
run_wer_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import unittest
import base
import remote
class Test(unittest.TestCase):
def setUp(self):
remote_dir = '/riseml/workspace/engine/exp/lls-new-data-v3-try1-wp500-adaptive-on-telis-chatbot/expr1-mwer/1pass_recog/chatbot_test_v3-lp0.10-beam16'
local_dir = base.mkdir('/Users/lls/tmp/run_wer_test')
remote.download(remote.ali_ssh, remote_dir + '.*', local_dir)
name = base.path_file_name(remote_dir)
self.nbest = local_dir + '/' + name + '.nbest'
self.refer = local_dir + '/' + name + '.refer'
self.best = local_dir + '/' + name + '.best'
self.log = local_dir + '/' + name + '.local.log'
base.GetBest(self.nbest, None, self.best)
def test(self):
os.system('python ./run_wer.py --best {} --refer {} --filter ./filters/wer_hyp_filter > {}'.format(
self.best, self.refer, self.log
))
os.system('python ./run_wer.py --nbest {} --refer {} --filter ./filters/wer_hyp_filter --oracle > {}'.format(
self.nbest, self.refer, self.log
))
if __name__ == '__main__':
unittest.main()