File size: 2,040 Bytes
09d3742
 
 
bcb2861
09d3742
bcb2861
09d3742
 
 
 
 
 
 
 
bcb2861
09d3742
 
 
 
 
 
 
 
 
54cc3db
90d12c5
 
 
 
54cc3db
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
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.