Skip to content
/ PCNN Public
forked from pencoa/PCNN

A neural architecture for relation extraction task implemented in Tensorflow.

License

Notifications You must be signed in to change notification settings

oddmen/PCNN

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 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 return, 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://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.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.5%
  • Makefile 0.5%