Skip to content

Commit

Permalink
Add data.json load for keywords (#279)
Browse files Browse the repository at this point in the history
* add data.json load

* CR
  • Loading branch information
bovard authored Jun 26, 2024
1 parent df7a038 commit 67709d6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kaggle_environments/envs/llm_20_questions/llm_20_questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@
keyword = keyword_obj["keyword"]
alts = keyword_obj["alts"]

try:
with open("/data.json") as f:
json_content = f.read()
d_keywords_list = json.loads(json_content)
d_keyword_cat = random.choice(d_keywords_list)
d_category = d_keyword_cat["category"]
d_keyword_obj = random.choice(d_keyword_cat["words"])
d_keyword = d_keyword_obj["keyword"]
d_alts = d_keyword_obj["alts"]
# re-assign
category = d_category
keyword = d_keyword
alts = d_alts
except:
pass


def random_guesser(obs):
if obs.turnType == GUESS:
Expand Down

0 comments on commit 67709d6

Please sign in to comment.