blob: 0b0da55950b14c934dabf9548a3ed3e9afe29352 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import os
import subprocess
import sys
class BLEUScorer:
def __init__(self, config):
self.config = config
def run(self):
args = [self.config.bleu_eval, '%s/test.nl' % self.config.experiment_dir]
infile = open('%s/hyp.nl' % self.config.experiment_dir)
nullfile = open(os.devnull, 'w')
p = subprocess.Popen(args, stdin=infile, stdout=sys.stdout, stderr=nullfile)
p.wait()
infile.close()
nullfile.close()
|