Awesome
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:
- master branch corresponds to the experiments with graph recategorization.
- 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
-
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).
-
Data Preprocessing:
sh preprocess_raw.sh ${input_file}
(when use graph recategorization, first download artifacts viash download_artifacts.sh
) -
sh work.sh
=>{load_path}{output_suffix}.pred
-
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
-
Unzip the corpus to
data/AMR/LDC2017T10
. -
Prepare training/dev/test splits:
sh prepare_data.sh -v 2 -p data/AMR/LDC2017T10
-
Download Artifacts:
sh download_artifacts.sh
-
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
-
Data Preprocessing:
sh preprocess_2.0.sh
-
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
-
We adopted the code snippets from stog for data preprocessing.
-
The dbpedia-spotlight occasionally does not work. Therefore, we have disabled it.
Contact
For any questions, please drop an email to Deng Cai.