summaryrefslogtreecommitdiff
path: root/gi/morf-segmentation/linestripper.py
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-10-22 12:07:20 +0100
committerKenneth Heafield <github@kheafield.com>2012-10-22 12:07:20 +0100
commit5f98fe5c4f2a2090eeb9d30c030305a70a8347d1 (patch)
tree9b6002f850e6dea1e3400c6b19bb31a9cdf3067f /gi/morf-segmentation/linestripper.py
parentcf9994131993b40be62e90e213b1e11e6b550143 (diff)
parent21825a09d97c2e0afd20512f306fb25fed55e529 (diff)
Merge remote branch 'upstream/master'
Conflicts: Jamroot bjam decoder/Jamfile decoder/cdec.cc dpmert/Jamfile jam-files/sanity.jam klm/lm/Jamfile klm/util/Jamfile mira/Jamfile
Diffstat (limited to 'gi/morf-segmentation/linestripper.py')
-rwxr-xr-xgi/morf-segmentation/linestripper.py40
1 files changed, 0 insertions, 40 deletions
diff --git a/gi/morf-segmentation/linestripper.py b/gi/morf-segmentation/linestripper.py
deleted file mode 100755
index 04e9044a..00000000
--- a/gi/morf-segmentation/linestripper.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/python
-
-import sys
-
-#linestripper file file maxlen [numlines]
-
-if len(sys.argv) < 3:
- print "linestripper file1 file2 maxlen [numlines]"
- print " outputs subset of file1 to stdout, ..of file2 to stderr"
- sys.exit(1)
-
-
-f1 = open(sys.argv[1],'r')
-f2 = open(sys.argv[2],'r')
-
-maxlen=int(sys.argv[3])
-numlines = 0
-
-if len(sys.argv) > 4:
- numlines = int(sys.argv[4])
-
-count=0
-for line1 in f1:
- line2 = f2.readline()
-
- w1 = len(line1.strip().split())
- w2 = len(line2.strip().split())
-
- if w1 <= maxlen and w2 <= maxlen:
- count = count + 1
- sys.stdout.write(line1)
- sys.stderr.write(line2)
-
- if numlines > 0 and count >= numlines:
- break
-
-f1.close()
-f2.close()
-
-