summaryrefslogtreecommitdiffstats
path: root/segment.py
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2013-02-01 13:03:31 +0800
committerPeng Wu <alexepico@gmail.com>2013-02-01 13:03:31 +0800
commit700107d2ec37727cb41f0143c8908f777d31197c (patch)
treebf59cbb6f7d57d16ed388e5c48fe952364d85764 /segment.py
parentdf43ebb8360fa5fafe801e01e7f2f6195d2b137a (diff)
downloadtrainer-700107d2ec37727cb41f0143c8908f777d31197c.tar.gz
trainer-700107d2ec37727cb41f0143c8908f777d31197c.tar.xz
trainer-700107d2ec37727cb41f0143c8908f777d31197c.zip
update segment.py
Diffstat (limited to 'segment.py')
-rwxr-xr-xsegment.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/segment.py b/segment.py
index 7992eb0..fe0ba68 100755
--- a/segment.py
+++ b/segment.py
@@ -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')