Parser for Abstract Meaning Representation
Python Lua Shell
Switch branches/tags
Nothing to show
Clone or download
Latest commit 2e89622 Jun 18, 2017
Permalink
Failed to load latest commit information.
amrevaluation cutorch commented Apr 5, 2017
contrib update collect.py May 4, 2017
nnets cutorch commented Apr 5, 2017
src fixed alignments Oct 27, 2016
.embs.py.swp cutorch commented Apr 5, 2017
.gitignore several small things including nodes and edges info in JAMR-like fashion Jan 6, 2017
LICENSE.txt Create LICENSE.txt Oct 8, 2016
README.md bib Jun 18, 2017
action.py fix tabs Jan 6, 2017
alignments.py fix tabs Jan 6, 2017
amr_test.py add preprocessing code Oct 16, 2016
amrdata.py cutorch commented Apr 5, 2017
buf.py fix tabs Jan 7, 2017
buftoken.py fix tabs Jan 7, 2017
collect.py fix tabs Jan 6, 2017
corenlp.properties add preprocessing code Oct 16, 2016
create_dataset.py fix tabs Jan 7, 2017
dependencies.py fix tabs Jan 6, 2017
download.sh resouces_single Apr 13, 2017
embs.py fix tabs Jan 7, 2017
en.out fix bugs May 9, 2017
en.sentences fix bugs May 9, 2017
history.py fix tabs Jan 6, 2017
hooks.py fix bugs May 9, 2017
node.py fix tabs Jan 7, 2017
oracle.py update collect.py May 4, 2017
orderedsets.py cutorch commented Apr 5, 2017
parser.py fix node generation issue Apr 7, 2017
preprocessing.py cutorch commented Apr 5, 2017
preprocessing.sh remove fixed filenames from preprocessing.sh Jan 12, 2017
projectivity.py cutorch commented Apr 5, 2017
relations.py fix tabs Jan 7, 2017
resources.py fix tabs Jan 7, 2017
rules.py fix tabs Jan 7, 2017
stack.py fix tabs Jan 7, 2017
state.py fix bugs May 9, 2017
subgraph.py cutorch commented Apr 5, 2017
tostring.py cutorch commented Apr 5, 2017
train.sh several small things including nodes and edges info in JAMR-like fashion Jan 6, 2017
transition_system.py update collect.py May 4, 2017
variables.py fix tabs Jan 6, 2017

README.md

amr-eager

AMR-EAGER [1] is a transition-based parser for Abstract Meaning Representation (http://amr.isi.edu/).

Installation

Run the parser with pretrained model

Note: the input file must contain English sentences (one sentence for line), see contrib/sample-sentences.txt for example.

Preprocessing:

./preprocessing.sh -s <sentences_file>

You should get the output files in the same directory as the input files, with the prefix <sentences_file> and extensions .out and .sentences.

python preprocessing.py -f <sentences_file>

You should get the output files in the same directory as the input files, with the prefix <sentences_file> and extensions .tokens.p, .dependencies.p.

Parsing:

python parser.py -f <file> -m <model_dir>

If you wish to have the list of all nodes and edges in a JAMR-like format, add option -n. Without -m the parser uses the model provided in the directory LDC2015E86.

Mac users: the pretrained models seem to have compatibility errors when running on Mac OS X.

Evaluation

We provide evaluation metrics to compare AMR graphs based on Smatch (http://amr.isi.edu/evaluation.html). The script computes a set of metrics between AMR graphs in addition to the traditional Smatch code:

  • Unlabeled: Smatch score computed on the predicted graphs after removing all edge labels
  • No WSD. Smatch score while ignoring Propbank senses (e.g., duck-01 vs duck-02)
  • Named Ent. F-score on the named entity recognition (:name roles)
  • Wikification. F-score on the wikification (:wiki roles)
  • Negations. F-score on the negation detection (:polarity roles)
  • Concepts. F-score on the concept identification task
  • Reentrancy. Smatch computed on reentrant edges only
  • SRL. Smatch computed on :ARG-i roles only

The different metrics are detailed and explained in [1], which also uses them to evaluate several AMR parsers. (Some of the metrics were recently fixed and updated)

cd amrevaluation
./evaluation.sh <file>.parsed <gold_amr_file>

To use the evaluation script with a different parser, provide the other parser's output as the first argument.

Train a model

  • Install JAMR aligner (https://github.com/jflanigan/jamr) and set path in preprocessing.sh

  • Preprocess training and validation sets:

    ./preprocessing.sh <amr_file>
    python preprocessing.py --amrs -f <amr_file>
    
  • Run the oracle to generate the training data:

    python collect.py -t <training_file> -m <model_dir>
    python create_dataset.py -t <training_file> -v <validation_file> -m <model_dir>
    
  • Train the three neural networks:

    th nnets/actions.lua --model_dir <model_dir>
    th nnets/labels.lua --model_dir <model_dir>
    th nnets/reentrancies.lua --model_dir <model_dir>
    

    (use also --cuda if you want to use GPUs).

  • Finally, move the .dat models generated by Torch in <model_dir>/actions.dat, <model_dir>/labels.dat and <model_dir>/reentrancies.dat.

  • To evaluate the performance of the neural networks run

    th nnets/report.lua <model_dir>
    
  • Note: If you used GPUs to train the models,you will need to uncomment the line require cunn from nnets/classify.lua.

Open-source code used:

References

[1] "An Incremental Parser for Abstract Meaning Representation", Marco Damonte, Shay B. Cohen and Giorgio Satta. Proceedings of EACL (2017). URL: https://arxiv.org/abs/1608.06111