Skip to main content

Japanese Predicate-Argument Structure Analyzer

Project description

Copyright (c) 2018 Inui-Suzuki Laboratory

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Description: # Showcase: Japanese Predicate-Argument Structure (PAS) analyzer

Showcase is a Pytorch implementation of the Japanese Predicate-Argument Structure (PAS) analyser presented in the paper of Matsubayashi & Inui (2018) with some improvements.
Given a input sentence, Showcase identifies verbal and nominal predicates in the sentence and detects their nominative (が), accusative (を), and dative (に) case arguments.
The output case labels are based on the label definition of the NAIST Text Corpus where case markers in different voices are generalized into the case markers of an active voice.

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Usage

### Pass input as an argument

-`echo '今日は雨が降る' | showcase`

### Pass input from STDIN

`cat example.txt | showcase`

### Input file format

- One raw sentence per line.
- A blank line can be used to segment a document. (Showcase just resets an argument index to zero.)


## Requirements

- Python 3.5 (or higher)
- We do not support Python 2
- [CaboCha](https://taku910.github.io/cabocha/) with JUMAN dict
- PyTorch 0.4.0

## Instllation

### Step 1. Install Showcase

`pip install showcase-parser`

### Step 2: Download Resources

Resources include following files:

- 10 Model files for predicate detector (`pred_model_0{0..9}.h5`)
- 10 Model files for argument detector (`arg_model_0{0..9}.h5`)
- Word embedding Matrix (`word_embedding.npz`)
- POS embedding Matrix (`pos_embedding.npz`)
- Word index file (`word.index`)
- Part-of-Speech tag index file (`pos.index`)

Resources are all available at [Google Drive](https://drive.google.com/drive/folders/1AK_oWgx1jd5cF2QAGv--r63ky0dgd52C?usp=sharing).

- train/*.h5: models trained with the training set described in the paper.
- train-test/*.h5: models trained with the training and test sets.

### Step 3: Create and edit config.json

Run `showcase setup` to create `config.json` file in `$HOME/.config/showcase`.

Then edit `config.json` and specify valid paths for:

- Resources downloaded in Step 2
- CaboCha and its JUMAN dictionary

Original `config.json` can be found at `showcase/data/config.json` of this repo.

You may specify path to `config.json` as follows:

`showcase -c /path/to/config/config.json`

Note that the apporopriate thresholds (hyperparameters) for arguments differ for each model.
The thresholds for the provided models are described in the sample config file in each Google Drive directory.

## (Re-)training
TBA

### Step1: Train word2vec
TBA

### Step2: Train model
TBA

### Step3: Convert word2vec

- run `get_vocab_from_word2vec.py` and `convert_word2vec_to_npy.py`

## Citation

```
@InProceedings{matsubayashi:2018:coling,
author = {Matsubayashi, Yuichiroh and Inui, Kentaro},
title = {Distance-Free Modeling of Multi-Predicate Interactions in End-to-End Japanese Predicate Argument Structure Analysis},
booktitle = {Proceedings of the 27th International Conference on Computational Linguistics (COLING)},
year = {2018},
}
```

Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.5
Provides-Extra: test
Provides-Extra: docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

showcase-parser-0.0.1.tar.gz (26.5 kB view hashes)

Uploaded Source

Built Distribution

showcase_parser-0.0.1-py3-none-any.whl (34.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page