Skip to content

Commit

Permalink
Merge pull request #149 from ufal/fix-campaign-config-missing
Browse files Browse the repository at this point in the history
fix parse_crowdsourcing_config default empty strings
  • Loading branch information
kasnerz authored Nov 8, 2024
2 parents 3d2c616 + a24517d commit fd2146f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions factgenie/crowdsourcing.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,19 @@ def get_service_ids(service, args):


def parse_crowdsourcing_config(config):
# parse Nones or empty strings
examples_per_batch = config.get("examplesPerBatch")
examples_per_batch = int(examples_per_batch) if examples_per_batch else 10
annotators_per_example = config.get("annotatorsPerExample")
annotators_per_example = int(annotators_per_example) if annotators_per_example else 1
idle_time = config.get("idleTime")
idle_time = int(idle_time) if idle_time else 120
config = {
"annotator_instructions": config.get("annotatorInstructions"),
"annotator_instructions": config.get("annotatorInstructions", "No instructions needed :)"),
"final_message": config.get("finalMessage"),
"examples_per_batch": int(config.get("examplesPerBatch")),
"annotators_per_example": int(config.get("annotatorsPerExample")),
"idle_time": int(config.get("idleTime")),
"examples_per_batch": int(examples_per_batch),
"annotators_per_example": int(annotators_per_example),
"idle_time": int(idle_time),
"annotation_granularity": config.get("annotationGranularity"),
"service": config.get("service"),
"sort_order": config.get("sortOrder"),
Expand Down

0 comments on commit fd2146f

Please sign in to comment.