Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 1.84 KB

File metadata and controls

52 lines (44 loc) · 1.84 KB

Counterfactual Recipe Generation

Source code and data for Counterfactual Recipe Generation: Exploring Models’ Compositional Generalization Ability in a Realistic Scenario (EMNLP2022 main conference paper)

Dependencies

  • Python>=3.7
  • nltk
  • bert_score
  • ltp
  • sklearn

Data

Our data is in the data/ folder. Task data:

L2 evaluation data:

  • glossary_dict.pkl: glossary of ingredient classes, verb classes, and tool classes
  • parsing_data.pkl: data used in parsing recipes into actions
  • pivot_actions.pkl: pivot actions and order constraints

Code

The code is in the code/ folder. Please change EVAL_TEXT_PATH to the path of generated recipes, and WORD_EMBEDDING_PATH to the word embedding path.

L1 evaluation (coverage of ingredients and extent of preservation):

python L1_eval.py

L2 evaluation (action-level):

python L2_eval.py

Citation

Please cite our paper if this repository inspires your work.

@article{liu2022counterfactual,
  title={Counterfactual Recipe Generation: Exploring Compositional Generalization in a Realistic Scenario},
  author={Liu, Xiao and Feng, Yansong and Tang, Jizhi and Hu, Chengang and Zhao, Dongyan},
  journal={arXiv preprint arXiv:2210.11431},
  year={2022}
}

Contact

If you have any questions regarding the code, please create an issue or contact the owner of this repository.