Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data.json load for keywords #279

Merged
merged 2 commits into from
Jun 26, 2024
Merged

Add data.json load for keywords #279

merged 2 commits into from
Jun 26, 2024

Conversation

bovard
Copy link
Member

@bovard bovard commented Jun 26, 2024

If data.json is detected, load the keywords from it.

     {
        "action": "",
        "info": {},
        "observation": {
          "answers": [
            "no"
          ],
          "category": "things",
          "guesses": [
            "banana"
          ],
          "keyword": "banana",
          "questions": [
            "Is it a thing?"
          ],
          "remainingOverageTime": 300,
          "role": "answerer",
          "turnType": "answer"
        },
        "reward": 20,
        "status": "DONE"
      }

@bovard bovard requested review from lipovetz, dster2 and hanwenzhz June 26, 2024 18:05
Copy link
Contributor

@dster2 dster2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Bovard!

category = keyword_cat["category"]
keyword_obj = random.choice(keyword_cat["words"])
keyword = keyword_obj["keyword"]
alts = keyword_obj["alts"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I imagine it's unlikely, but would be weird if you had an exception in the later portion of this chunk, for example a missing key in the keyword_obj dict, then we'd have inconsistencies in the datasets. You could limit the try to only the open call, or other approaches.

@bovard bovard merged commit 67709d6 into master Jun 26, 2024
4 checks passed
@bovard bovard deleted the read-data-json branch June 26, 2024 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants