Skip to content

Commit

Permalink
Treat rejected checks as unfinished
Browse files Browse the repository at this point in the history
  • Loading branch information
tuetschek committed Mar 22, 2016
1 parent 9d542ed commit f0042d4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions alex/tools/crowdflower/nlg_job/get_unfinished.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,16 @@ def main(args):
with finished_file as fh:
csvread = csv.reader(fh, delimiter=str(args.finished_csv_delim),
quotechar=b'"', encoding="UTF-8")
columns = DataLine.get_columns_from_header(csvread.next())
header = csvread.next();
columns = DataLine.get_columns_from_header(header)
try:
judgment_column = header.index('check_result')
except ValueError:
judgment_column = None
for row in csvread:
# treat rejected as unfinished
if judgment_column is not None and row[judgment_column].startswith('N'):
continue
# keep track of how many judgments are finished in the results
finished_line = DataLine.from_csv_line(row, columns)
finished[finished_line.signature] += 1
Expand All @@ -50,7 +58,7 @@ def main(args):

with sys.stdout as fh:
# starting with the header
csvwrite = csv.writer(fh, delimiter=b"\t", encoding="UTF-8")
csvwrite = csv.writer(fh, delimiter=b"\t", lineterminator="\n", encoding="UTF-8")
csvwrite.writerow(DataLine.get_headers())
# write rows requiring different number of judgments, starting from the most judgments
for judg_req in xrange(args.num_judgments, 0, -1):
Expand Down

0 comments on commit f0042d4

Please sign in to comment.