diff options
author | Peng Wu <alexepico@gmail.com> | 2013-02-01 13:03:31 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-02-01 13:03:31 +0800 |
commit | 700107d2ec37727cb41f0143c8908f777d31197c (patch) | |
tree | bf59cbb6f7d57d16ed388e5c48fe952364d85764 /segment.py | |
parent | df43ebb8360fa5fafe801e01e7f2f6195d2b137a (diff) | |
download | trainer-700107d2ec37727cb41f0143c8908f777d31197c.tar.gz trainer-700107d2ec37727cb41f0143c8908f777d31197c.tar.xz trainer-700107d2ec37727cb41f0143c8908f777d31197c.zip |
update segment.py
Diffstat (limited to 'segment.py')
-rwxr-xr-x | segment.py | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -29,18 +29,15 @@ def segmentOneText(infile, outfile, reportfile, fast): #begin processing if fast: - cmdline = '../utils/segment/spseg >"' + outfile + '"' + cmdline = ['../utils/segment/spseg', \ + '-o', outfile, infile] else: - cmdline = '../utils/segment/ngseg >"' + outfile + '"' + cmdline = ['../utils/segment/ngseg', \ + '-o', outfile, infile] - subprocess = Popen(cmdline, shell=True, stdin=PIPE, stderr=PIPE, \ + subprocess = Popen(cmdline, shell=False, stderr=PIPE, \ close_fds=True) - with open(infile, 'rb') as f: - subprocess.stdin.writelines(f.readlines()) - subprocess.stdin.close() - f.close() - lines = subprocess.stderr.readlines() if lines: print('found error report') |