Giter VIP home page Giter VIP logo

hit-scir-conll2019's Introduction

HIT-SCIR CoNLL2019 Unified Transition-Parser

This repository accompanies the paper, "HIT-SCIR at MRP 2019: A Unified Pipeline for Meaning Representation Parsing via Efficient Training and Effective Encoding", providing codes to train models and pre/post-precessing mrp dataset.

CoNLL2019 Shared Task Official Website: http://mrp.nlpl.eu/

Pre-requisites

  • Python 3.6
  • JAMR
  • NLTK
  • Gensim
  • Penman
  • AllenNLP 0.9.0

Dataset

Total training data is available at mrp-data.

Usage

Prepare data

Step 1: Add companion to raw data.

We use conllu format companion data. This command adds companion.conllu to data.mrp and outputs to data.aug.mrp

python3 toolkit/augment_data.py \
    companion.conllu \
    data.mrp \
    data.aug.mrp

For evaluation data, you need to convert udpipe to conllu format and split raw input to 5 files. Run this command instead.

python3 toolkit/preprocess_eval.py \
    udpipe.mrp \
    input.mrp \
    --outdir /path/to/output

Step 2 (only for AMR): Convert data to amr format and run TAMR aligner.

Different from the other 4 parsers, our AMR parser accepts input of augmented amr format instead of mrp format.

Since TAMR's alignment is built on the JAMR alignment results, you need to set JAMR and CDEC path in bash/amr_preprocess.sh and run the command below.

bash bash/amr_preprocess.sh \
    data.aug.mrp \
    /path/to/word2wec

The final output is data.aug.mrp.actions.aug.txt which can be input to AMR parser.

According to TAMR, it is recommended to use the glove.840B.300d and filter the embeddings by the words and concepts (trimming the tail in word sense) in the data.

Train the parser

Based on AllenNLP, the training command is like

CUDA_VISIBLE_DEVICES=${gpu_id} \
TRAIN_PATH=${train_set} \
DEV_PATH=${dev_set} \
BERT_PATH=${bert_path} \
WORD_DIM=${bert_output_dim} \
LOWER_CASE=${whether_bert_is_uncased} \
BATCH_SIZE=${batch_size} \
    allennlp train \
        -s ${model_save_path} \
        --include-package utils \
        --include-package modules \
        --file-friendly-logging \
        ${config_file}

Refer to bash/train.sh for more and detailed examples.

Predict with the parser

The predicting command is like

CUDA_VISIBLE_DEVICES=${gpu_id} \
    allennlp predict \
        --cuda-device 0 \
        --output-file ${output_path} \
        --predictor ${predictor_class} \
        --include-package utils \
        --include-package modules \
        --batch-size ${batch_size} \
        --silent \
        ${model_save_path} \
        ${test_set}

More examples in bash/predict.sh.

Package structure

  • bash/ command pipelines and examples
  • config/ Jsonnet config files
  • metrics/ metrics used in training and evaluation
  • modules/ implementations of modules
  • toolkit/ external libraries and dataset tools
  • utils/ code for input/output and pre/post-processing

Acknowledgement

Thanks to the task organizers and also thanks to the developer of AllenNLP, JAMR and TAMR.

Contacts

For further information, please contact [email protected], [email protected]

hit-scir-conll2019's People

Contributors

longxudou avatar franklear avatar

Watchers

James Cloos 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.