Giter Club home page Giter Club logo

tupa's Introduction

Transition-based UCCA Parser

TUPA is a transition-based parser for Universal Conceptual Cognitive Annotation (UCCA).

Requirements

Install

Create a Python virtual environment:

virtualenv --python=/usr/bin/python3 venv
. venv/bin/activate              # on bash
source venv/bin/activate.csh     # on csh

Install the latest release:

pip install tupa

Alternatively, install the latest code from GitHub (may be unstable):

git clone https://github.com/danielhers/tupa
cd tupa
python setup.py install

The parser requires the English model for spaCy to be available. To install it run:

python -m spacy download en

Train the parser

Having a directory with UCCA passage files (for example, the Wiki corpus), run:

python -m tupa.parse -t <train_dir> -d <dev_dir> -c <model_type> -m <model_filename>

The possible model types are sparse, mlp and bilstm.

Parse a text file

Run the parser on a text file (here named example.txt) using a trained model:

python -m tupa.parse example.txt -c <model_type> -m <model_filename>

An xml file will be created per passage (separate by blank lines in the text file).

Pre-trained models

To download and extract the pre-trained models, run:

curl --remote-name-all http://www.cs.huji.ac.il/~danielh/ucca/{sparse,mlp,bilstm}.tar.gz
tar xvzf sparse.tar.gz
tar xvzf mlp.tar.gz
tar xvzf bilstm.tar.gz

Run the parser using any of them:

python -m tupa.parse example.txt -c sparse -m models/sparse
python -m tupa.parse example.txt -c mlp -m models/mlp
python -m tupa.parse example.txt -c bilstm -m models/bilstm

Author

Citation

If you make use of this software, please cite the following paper:

@InProceedings{hershcovich2017a,
  author    = {Hershcovich, Daniel  and  Abend, Omri  and  Rappoport, Ari},
  title     = {A Transition-Based Directed Acyclic Graph Parser for UCCA},
  booktitle = {Proc. of ACL},
  year      = {2017},
  pages     = {1127--1138},
  url       = {http://aclweb.org/anthology/P17-1104}
}

The version of the parser used in the paper is v1.0. To reproduce the experiments from the paper, run in an empty directory (with a new virtualenv):

pip install "tupa>=1.0,<1.1"
mkdir pickle models
curl -L http://www.cs.huji.ac.il/~danielh/ucca/ucca_corpus_pickle.tgz | tar xz -C pickle
curl --remote-name-all http://www.cs.huji.ac.il/~danielh/ucca/{sparse,mlp,bilstm}.tgz
tar xvzf sparse.tgz
tar xvzf mlp.tgz
tar xvzf bilstm.tgz
python -m spacy download en
python -m scripts.split_corpus pickle -t 4282 -d 454 -l
python -m tupa.parse -c sparse -m models/ucca-sparse -Web pickle/test
python -m tupa.parse -c mlp -m models/ucca-mlp -Web pickle/test
python -m tupa.parse -c bilstm -m models/ucca-bilstm -Web pickle/test

License

This package is licensed under the GPLv3 or later license (see LICENSE.txt).

Build Status PyPI version

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.