summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xreduce.py2
-rwxr-xr-xsegment.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/reduce.py b/reduce.py
index 6ad9824..2751124 100755
--- a/reduce.py
+++ b/reduce.py
@@ -57,5 +57,5 @@ if __name__ == '__main__':
args = parser.parse_args()
print(args)
- iterateSubDirectory(args.origdir, args.destdir, args.level)
+ iterateSubDirectory(args.origdir, args.destdir, int(args.level))
print('done')
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')