Code Monkey home page Code Monkey logo

counterfactual-recipe-generation's Introduction

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.

counterfactual-recipe-generation's People

Contributors

xxxiaol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

elazarha

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.