MAWPS / README.md
garrethlee's picture
garrethlee HF staff
Update README.md
90d12c5 verified
---
dataset_info:
features:
- name: question
dtype: string
- name: answer
dtype: string
splits:
- name: train
num_bytes: 242439.74379232505
num_examples: 1417
- name: test
num_bytes: 60738.256207674945
num_examples: 355
download_size: 161461
dataset_size: 303178.0
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
- split: test
path: data/test-*
---
**MAWPS : A Math Word Problem Repository**
- Paper: https://aclanthology.org/N16-1136/
- Github: https://github.com/sroy9/mawps
Adapted from https://huggingface.co/datasets/mwpt5/MAWPS
Processed with the following code:
```
def process_row(row):
# Create placeholder-to-actual mapping
placeholder_map = [(f"N_{i:02}", actual) for i, actual in enumerate(row['Numbers'].split())]
try:
# Process placeholders and replacements
for placeholder, replacement in placeholder_map:
replacement_value = float(replacement)
# Convert to integer if it is a whole number, otherwise round to 2 decimal places
replacement = str(int(replacement_value)) if replacement_value.is_integer() else str(round(replacement_value, 2))
# Update Question and Equation with the new replacement value
row['Question'] = row['Question'].strip().replace(placeholder, replacement)
row['Equation'] = row['Equation'].strip().replace(placeholder, replacement)
# Process Answer
answer_value = float(row['Answer'])
row['Answer'] = str(int(answer_value)) if answer_value.is_integer() else str(round(answer_value, 2))
# Format the final answer string
row['Answer'] = f"{row['Equation']} = {row['Answer']} #### {row['Answer']}"
except ValueError as e:
print(f"ValueError: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
return row
```
To format the answers, I used a similar formatting style to GSM8K's answers, which allows for easy parsing for evaluation.