Code Monkey home page Code Monkey logo

amr-gs's Introduction

AMR Parsing via Graph-Sequence Iterative Inference

Code for our ACL2020 paper,

AMR Parsing via Graph-Sequence Iterative Inference [preprint]

Deng Cai and Wai Lam.

Introduction

The code has two branches:

  1. master branch corresponds to the experiments with graph recategorization.
  2. no-recategorize branch corresponds to the experiments without graph recategorization.

Requirements

The code has been tested on Python 3.6. All dependencies are listed in requirements.txt.

AMR Parsing with Pretrained Models

  1. We use Stanford CoreNLP (version 3.9.2) for lemmatizing, POS tagging, etc.

    sh run_standford_corenlp_server.sh
    

    The input file should constain the raw sentences to parse (one sentence per line).

  2. Data Preprocessing: sh preprocess_raw.sh ${input_file} (when use graph recategorization, first download artifacts via sh download_artifacts.sh)

  3. sh work.sh => {load_path}{output_suffix}.pred

  4. sh postprocess_2.0.sh {load_path}{output_suffix}.pred=> {load_path}{output_suffix}.pred.post

Download Links

Model Link
AMR2.0+BERT+GR=Smatch80.2 amr2.0.bert.gr.tar.gz
AMR2.0+BERT=Smatch78.7 amr2.0.bert.tar.gz

Train New Parsers

The following instruction assumes that you're training on AMR 2.0 (LDC2017T10). For AMR 1.0, the procedure is similar.

Data Preparation

  1. Unzip the corpus to data/AMR/LDC2017T10.

  2. Prepare training/dev/test splits:

    sh prepare_data.sh -v 2 -p data/AMR/LDC2017T10

  3. Download Artifacts:

    sh download_artifacts.sh

  4. Feature Annotation:

    We use Stanford CoreNLP (version 3.9.2) for lemmatizing, POS tagging, etc.

    sh run_standford_corenlp_server.sh
    sh annotate_features.sh data/AMR/amr_2.0
    
  5. Data Preprocessing:

    sh preprocess_2.0.sh

  6. Building Vocabs

    sh prepare.sh data/AMR/amr_2.0

Training

sh train.sh data/AMR/amr_2.0

The training process will produce many checkpoints and the corresponding output on dev set. To select the best checkpoint, one can evaluate the dev output files (need to do postprocessing first). It is recommended to use fast smatch for model selection.

Evaluation

For evaluation, following Parsing with Pretrained Models step 2-3, then sh compute_smatch {load_path}{output_suffix}.pred.post data/AMR/amr_2.0/test.txt.

Notes

  1. We adopted the code snippets from stog for data preprocessing.

  2. The dbpedia-spotlight occasionally does not work. Therefore, we have disabled it.

Contact

For any questions, please drop an email to Deng Cai.

amr-gs's People

Contributors

jcyk 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.