Giter Club home page Giter Club logo

mrc-explanation's Introduction

Source Code for "Teaching Machine Comprehension with Compositional Explanations" (Findings of EMNLP 2020)

TL;DR: We collect human explanations that justifies their answering decisions when doing QA task; We transform these explanations into executable “teacher” programs; We use programs to annotate unlabeled QA examples and train a “student” QA model.

Project homepage: http://inklab.usc.edu/mrc-explanation-project/

Configure Environment

conda create -n mrc-explanation python=3.6.9
conda activate mrc-explanation
pip install torch==1.4.0 allennlp==0.9.0 nltk==3.4.5 pandas==0.25.3

Then navigate to nltk source code nltk/parse/chart.py, line 685, modify function parse, change for edge in self.select(start=0, end=self._num_leaves,lhs=root): to for edge in self.select(start=0, end=self._num_leaves):.

Download Data

Please download pre-processed data and explanations from here. Please put the csv files at ./explanations and json files at ./data/squad.

Example

This code snippet contains a minimal example that explains how an explanation is parsed, and how a constructed program is used to annotate new instances.

PYTHONPATH='.' python parser/example.py

Parse SQuAD Explanations

PYTHONPATH='.' python parser/parse_squad_exps.py --verbose --save_ans_func

Hard Match

PYTHONPATH='.' python parser/match_squad_hard.py --nproc 32 --verbose --save_matched

mrc-explanation's People

Contributors

cherry979988 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.