summaryrefslogtreecommitdiffstats
path: root/segment.py
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2011-07-21 11:23:26 +0800
committerPeng Wu <alexepico@gmail.com>2011-07-21 11:23:26 +0800
commiteea694d78b09818af1d3bba432bfa97262db8c2a (patch)
treeba8b006d9ca492717a33f4768b3948369ec6d242 /segment.py
parent6bbdcff2c292258572072d01d9e170a298798513 (diff)
downloadtrainer-eea694d78b09818af1d3bba432bfa97262db8c2a.tar.gz
trainer-eea694d78b09818af1d3bba432bfa97262db8c2a.tar.xz
trainer-eea694d78b09818af1d3bba432bfa97262db8c2a.zip
refine segment.py
Diffstat (limited to 'segment.py')
-rwxr-xr-xsegment.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/segment.py b/segment.py
index fbd7f65..b65bfd7 100755
--- a/segment.py
+++ b/segment.py
@@ -26,10 +26,15 @@ def segmentOneText(infile, outfile, reportfile):
return
#begin processing
- cmdline = './ngseg <"' + infile + '" >"' + outfile + '"'
- subprocess = Popen(cmdline, shell=True, stderr=PIPE, \
+ cmdline = './ngseg >"' + outfile + '"'
+ subprocess = Popen(cmdline, shell=True, stdin=PIPE, 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')