diff options
author | Peng Wu <alexepico@gmail.com> | 2011-07-27 23:05:23 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-07-27 23:05:23 +0800 |
commit | 499b18a799dd14b3ce584be0848d648400727776 (patch) | |
tree | 12072dcd50ea02d55f83d60cf34fc51be7849a1c /evaluate.py | |
parent | 9d6560b9c3ec566b1cb4c216495745aa1ffac96d (diff) | |
download | trainer-499b18a799dd14b3ce584be0848d648400727776.tar.gz trainer-499b18a799dd14b3ce584be0848d648400727776.tar.xz trainer-499b18a799dd14b3ce584be0848d648400727776.zip |
suppress evaluate.py output
Diffstat (limited to 'evaluate.py')
-rwxr-xr-x | evaluate.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/evaluate.py b/evaluate.py index c54f1a6..a609e79 100755 --- a/evaluate.py +++ b/evaluate.py @@ -97,7 +97,7 @@ def modifyCodeforLambda(lambdaparam): #end processing -def evaluateModel(): +def evaluateModel(reportfile): #change to utils/training subdir cwd = os.getcwd() os.chdir(os.path.join(libpinyindir, 'utils', 'training')) @@ -106,9 +106,9 @@ def evaluateModel(): rate = 0. #begin processing - cmdline = ['./eval_correction_rate'] + cmdline = './eval_correction_rate 2>"' + reportfile + '"' - subprocess = Popen(cmdline, shell=False, stdout=PIPE, \ + subprocess = Popen(cmdline, shell=True, stdout=PIPE, \ close_fds=True) for line in subprocess.stdout.readlines(): @@ -166,7 +166,7 @@ if __name__ == '__main__': print('estimating') reportfile = os.path.join \ - (trydir, 'estimate_interpolation' + config.getReportPostfix()) + (trydir, 'estimate' + config.getReportPostfix()) avg_lambda = estimateModel(reportfile) cwdstatus['EvaluateAverageLambda'] = avg_lambda @@ -176,7 +176,9 @@ if __name__ == '__main__': modifyCodeforLambda(avg_lambda) print('evaluating') - rate = evaluateModel() + reportfile = os.path.join \ + (trydir, 'evaluate' + config.getReportPostfix()) + rate = evaluateModel(reportfile) print(tryname + "'s correction rate:", rate) cwdstatus['EvaluateCorrectionRate'] = rate |