summaryrefslogtreecommitdiff
path: root/gi/morf-segmentation/linestripper.py
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-10-11 14:06:32 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-10-11 14:06:32 -0400
commit07ea7b64b6f85e5798a8068453ed9fd2b97396db (patch)
tree644496a1690d84d82a396bbc1e39160788beb2cd /gi/morf-segmentation/linestripper.py
parent37b9e45e5cb29d708f7249dbe0b0fb27685282a0 (diff)
parenta36fcc5d55c1de84ae68c1091ebff2b1c32dc3b7 (diff)
Merge branch 'master' of https://github.com/redpony/cdec
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()
-
-