|
import pandas as pd |
|
import datasets |
|
from datasets import GeneratorBasedBuilder |
|
|
|
_URL = './data/EuclideaGame.csv' |
|
|
|
_CITATION = """\ |
|
@misc{mouselinos2024lines, |
|
title={Beyond Lines and Circles: Unveiling the Geometric Reasoning Gap in Large Language Models}, |
|
author={Spyridon Mouselinos and Henryk Michalewski and Mateusz Malinowski}, |
|
year={2024}, |
|
eprint={2402.03877}, |
|
archivePrefix={arXiv}, |
|
primaryClass={cs.CL} |
|
} |
|
""" |
|
|
|
|
|
|
|
class EuclideaGame(GeneratorBasedBuilder): |
|
def __init__(self, pack=None, **kwargs): |
|
super().__init__(**kwargs) |
|
self.pack = pack |
|
|
|
def _info(self): |
|
return datasets.DatasetInfo( |
|
description="This dataset is a collection of the Euclidea " |
|
"geometry game levels, alongside their provided solutions.", |
|
features=datasets.Features({ |
|
"pack": datasets.ClassLabel( |
|
names=["Alpha", |
|
"Beta", |
|
"Gamma", |
|
"Delta", |
|
"Epsilon", |
|
"Zeta", |
|
"Eta", |
|
"Theta", |
|
"Iota", |
|
"Kappa", |
|
"Lambda"]), |
|
"level_id": datasets.Value("string"), |
|
"question": datasets.Value("string"), |
|
"solution_nl": datasets.Value("string"), |
|
"solution_tool": datasets.Value("string"), |
|
"solution_symbol": datasets.Value("string"), |
|
"initial_symbol": datasets.Value("string") |
|
}), |
|
citation=_CITATION, |
|
) |
|
|
|
def _split_generators(self, dl_manager): |
|
"""Point to local file path within the repository.""" |
|
data_path = dl_manager.download_and_extract(_URL) |
|
return [ |
|
datasets.SplitGenerator( |
|
name=datasets.Split.TRAIN, |
|
gen_kwargs={"filepath": data_path, "pack": self.pack} |
|
) |
|
] |
|
|
|
def _generate_examples(self, filepath, pack=None): |
|
data = pd.read_csv(filepath) |
|
if pack: |
|
data = data[data['pack'].isin(pack)] |
|
for idx, row in data.iterrows(): |
|
yield idx, { |
|
'pack': row['pack'], |
|
'level_id': row['level_id'], |
|
'question': row['question'], |
|
'solution_nl': row['solution_nl'], |
|
'solution_tool': row['solution_tool'], |
|
'solution_symbol': row['solution_symbol'], |
|
'initial_symbol': row['initial_symbol'] |
|
} |
|
|