mengqunhan / MWP-NAS

Non-Autoregressive Math Word Problem Solver with Unified Tree Structure
MIT License
11 stars 1 forks source link

Non-Autoregressive Math Word Problem Solver with Unified Tree Structure

This is the offcial repo for the paper "Non-Autoregressive Math Word Problem Solver with Unified Tree Structure".

Requirements

Datasets

Before you use the code in Math23K dictionary, please download the missing train dataset from this link and put it in ./Math23K/datasets/.

Usage

Train

To train our model on Math23K, run:

python ./Math23K/main.py --mode train

To train our model on MAWPS, run:

python ./MAWPS/main_mawps.py

Test

If you want to load the check points, please make sure you have downloaded the required files:

Please put the check point files(Math23K and MAWPS) in ./Math23K/check_points/ and ./MAWPS/check_points/.

To use the check points and test the model on Math23K, run:

python ./Math23K/main.py --mode test

To use the check points and test the model on MAWPS, run:

python ./MAWPS/test_mawps.py

MTree Acc and MTree IoU Evaluation

MTree Acc is proposed to solve the problem of mathematical expression variants and alleviate the drawback that Expression Acc underestimates the performance of MWP solvers. MTree IoU is proposed to evaluate the partial correctness of the prediction expression obtained by MWP solvers.

In ./Evaluation/ we provide a tool to evaluate MTree Acc and MTree IoU. You just need to convert the prediction from your model and groundtruth into the form shown in ./Evaluation/examples.json, then run:

python ./Evaluation/evaluate.py

Citation

# If this repo is helpful to your work, please kindly cite our paper:

@inproceedings{DBLP:conf/emnlp/BinHSW0NS23,
  author       = {Yi Bin and
                  Mengqun Han and
                  Wenhao Shi and
                  Lei Wang and
                  Yang Yang and
                  See{-}Kiong Ng and
                  Heng Tao Shen},
  title        = {Non-Autoregressive Math Word Problem Solver with Unified Tree Structure},
  booktitle    = {{EMNLP}},
  pages        = {3290--3301},
  publisher    = {Association for Computational Linguistics},
  year         = {2023}
}