Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefantaubert committed Jun 14, 2023
1 parent 1a44584 commit 0019f89
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions src/tts_mos_test_mturk/df_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ def generate_approve_csv(data: EvaluationData, mask_names: Set[str], reason: Opt
# worker_data[assignment_id] = assignment_meta
results_dict.append({
"WorkerId": worker_id,
"AssignmentId": assignment_id
"AssignmentId": assignment_id,
"Gender": data.worker_data[worker_id].gender,
"AgeGroup": data.worker_data[worker_id].age_group,
"HITId": data.worker_data[worker_id].assignments[assignment_id].hit_id,
"Device": data.worker_data[worker_id].assignments[assignment_id].device,
"State": data.worker_data[worker_id].assignments[assignment_id].state,
"Time": datetime.datetime.strftime(data.worker_data[worker_id].assignments[assignment_id].time, "%m.%d.%Y %H:%M:%S"),
})

result = pd.DataFrame.from_records(results)
Expand Down Expand Up @@ -239,7 +245,13 @@ def generate_reject_csv(data: EvaluationData, mask_names: Set[str], reject_mask_
# worker_data.append(assignment_id)
results_dict.append({
"WorkerId": worker_id,
"AssignmentId": assignment_id
"AssignmentId": assignment_id,
"Gender": data.worker_data[worker_id].gender,
"AgeGroup": data.worker_data[worker_id].age_group,
"HITId": data.worker_data[worker_id].assignments[assignment_id].hit_id,
"Device": data.worker_data[worker_id].assignments[assignment_id].device,
"State": data.worker_data[worker_id].assignments[assignment_id].state,
"Time": datetime.datetime.strftime(data.worker_data[worker_id].assignments[assignment_id].time, "%m.%d.%Y %H:%M:%S"),
})
result = pd.DataFrame.from_records(results)
if len(result.index) > 0:
Expand Down Expand Up @@ -296,7 +308,13 @@ def generate_bonus_csv(data: EvaluationData, mask_names: Set[str], bonus: float,
results.append(line)
results_dict.append({
"WorkerId": worker_id,
"AssignmentId": assignment_id
"AssignmentId": assignment_id,
"Gender": data.worker_data[worker_id].gender,
"AgeGroup": data.worker_data[worker_id].age_group,
"HITId": data.worker_data[worker_id].assignments[assignment_id].hit_id,
"Device": data.worker_data[worker_id].assignments[assignment_id].device,
"State": data.worker_data[worker_id].assignments[assignment_id].state,
"Time": datetime.datetime.strftime(data.worker_data[worker_id].assignments[assignment_id].time, "%m.%d.%Y %H:%M:%S"),
})
result = pd.DataFrame.from_records(results)
if len(result.index) > 0:
Expand Down Expand Up @@ -338,17 +356,16 @@ def generate_ground_truth_table(data: EvaluationData, mask_names: Set[str]) -> p
line["File"] = file_name
for rating_name, rating in ass_ratings.votes.items():
line[f"Rating \"{rating_name}\""] = rating
line["AcceptTime"] = assignment_data.time
line["FinishTime"] = assignment_data.time + \
datetime.timedelta(seconds=assignment_data.worktime)
line["Worktime"] = str(datetime.timedelta(seconds=assignment_data.worktime))
line["Worktime (s)"] = assignment_data.worktime
# line["AcceptTime"] = assignment_data.time
# line["FinishTime"] = assignment_data.time + datetime.timedelta(seconds=assignment_data.worktime)
# line["Worktime"] = str(datetime.timedelta(seconds=assignment_data.worktime))
# line["Worktime (s)"] = assignment_data.worktime
line["Device"] = assignment_data.device
line["State"] = assignment_data.state
line["HITId"] = assignment_data.hit_id
line["AssignmentId"] = assignment
line["Masked?"] = is_masked
line["Comments"] = assignment_data.comments
# line["Comments"] = assignment_data.comments
results.append(line)

result = pd.DataFrame.from_records(results)
Expand Down

0 comments on commit 0019f89

Please sign in to comment.