Skip to content
/ PCNN Public

A neural architecture for relation extraction task implemented in Tensorflow.

License

Notifications You must be signed in to change notification settings

pencoa/PCNN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PCNN

Piecewise Convolution Neural Network is one kind of architecture for Relation Extraction task in NLP.
Applying one traditional single layer Convolution on sentence embeddings can capture n-gram features. After max pooling, only the strongest feature returns, which is insufficient for Relation Extraction tasks.
The PCNN architecture divide one sentence into three parts according to entities positions. This modification improve the capability of Relation Extraction.
The original architecture of PCNN is designed as follows.
origin PCNN This project re-implement the paper, Distant Supervision for Relation Extraction via Piecewise Convolutional Neural Networks, in Tensorflow.
Since it is still unsupported to split tensors into variable lengths in Tensorflow. The architecture is modified slightly as follows.
PCNN

Getting Started

Prerequisites

  • Python3(build with 3.6)

Installing

Required

Install python package in virtual environment

pip install -r requirements

Optional

To shuffle dataset, shuf is needed. And it is already installed on Linux.
Usage

shuf -o ./path/to/shuf_data ./path/to/origin_data

On OS X, gshuf is alternative.

brew install coreutils
gshuf -o ./path/to/shuf_data ./path/to/origin_data

You can configure ./model/config.py to set parameters.

Download Dataset

make download

Run

Run this project.

make run

Tensorboard

Using tensorboard

tensorboard --logdir="./graph" --port 6006

Open browser in http:https://localhost:6006/

License

This project is licensed under the Apache License - see the LICENSE.txt file for details

Cite

@inproceedings{Zeng2015DistantSF,
  title={Distant Supervision for Relation Extraction via Piecewise Convolutional Neural Networks},
  author={Daojian Zeng and Kang Liu and Yubo Chen and Jun Zhao},
  booktitle={EMNLP},
  year={2015}
}

About

A neural architecture for relation extraction task implemented in Tensorflow.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published