Mix easy and hard prompts

This commit is contained in:
Dominic Zimmer 2022-08-26 12:44:52 +02:00
parent 3bb036b7c5
commit 985f933859

View File

@ -14,6 +14,7 @@ with open("prompts.txt") as f:
stripped = "".join(raw_sentences).strip().split("\n") stripped = "".join(raw_sentences).strip().split("\n")
sentences["easy"] = [ line for line in stripped if "*" not in line ] sentences["easy"] = [ line for line in stripped if "*" not in line ]
sentences["hard"] = [ line.replace("*","") for line in stripped if "*" in line ] sentences["hard"] = [ line.replace("*","") for line in stripped if "*" in line ]
sentences["all"] = [ line.replace("*","") for line in stripped ]
print(f"[INFO] Found {len(sentences['easy'])} easy prompts") print(f"[INFO] Found {len(sentences['easy'])} easy prompts")
print(f"[INFO] Found {len(sentences['hard'])} hard prompts") print(f"[INFO] Found {len(sentences['hard'])} hard prompts")
@ -22,7 +23,7 @@ print(f"[INFO] Found {len(sentences['hard'])} hard prompts")
""" Postprocess the content string to look nice in the latex tabular cell """ """ Postprocess the content string to look nice in the latex tabular cell """
def make_cell(content: str): def make_cell(content: str):
return fr"""\vspace{{0.5cm}} return fr"""\vspace{{0.5cm}}
\rule{{3cm}}{{0.15mm}} \, \newline \small {content} \rule{{3cm}}{{0.15mm}} \, \vspace{{.3cm}} \newline \small {content}
\vspace{{0.5cm}}""" \vspace{{0.5cm}}"""
def substitute_texts(text: str, substitutions: list[str]): def substitute_texts(text: str, substitutions: list[str]):
@ -39,7 +40,8 @@ def gen_board(num: int = 1):
print(f"Generating {num} boards") print(f"Generating {num} boards")
for i in range(1, num+1): for i in range(1, num+1):
prompts = [ *random.sample(sentences["easy"], num_easy), *random.sample(sentences["hard"], num_hard) ] #prompts = [ *random.sample(sentences["easy"], num_easy), *random.sample(sentences["hard"], num_hard) ]
prompts = [ *random.sample(sentences["all"], num_total) ]
random.shuffle(prompts) random.shuffle(prompts)
pick = substitute_texts(latex_template, prompts) pick = substitute_texts(latex_template, prompts)