-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilter.py
More file actions
64 lines (48 loc) · 1.6 KB
/
Copy pathfilter.py
File metadata and controls
64 lines (48 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import sys
infile = open("filter/original.tsv", "r")
outfile_keep = open("filter/keep.tsv", "a")
outfile_delete = open("filter/delete.tsv", "a")
outfile_fix = open("filter/fix.tsv", "a")
outfile_ponder = open("filter/ponder.tsv", "a")
lines = [line.strip() for line in infile]
infile.close()
while lines != []:
line = lines[0]
parts = line.split("\t")
toaq = parts[1]
eng = parts[2]
if not (toaq == "" and eng == ""):
print()
print(" " + toaq)
print(" " + eng)
print("")
print(" (k) keep this sentence as-is")
print(" (d) delete this sentence")
print(" (f) fix this sentence later")
print(" (p) ponder this sentence later")
print(" (q) quit and save progress")
print("")
response = ""
while True:
response = input("> ")
if response == "k":
print(line, file=outfile_keep)
break
if response == "d":
print(line, file=outfile_delete)
break
if response == "f":
print(line, file=outfile_fix)
break
if response == "p":
print(line, file=outfile_ponder)
break
if response == "q":
outfile_keep.close()
outfile_delete.close()
outfile_fix.close()
infile = open("filter/original.tsv", "w")
for line in lines:
print(line, file=infile)
sys.exit()
lines = lines[1:]