TensorFlow implementation of PCNN network for relation extraction.
Use train_PCNN_mask.py & test_PCNN_mask.py for 'masked pooling' implementation.
In the original version we slice sentences into three parts and pad each part to the length of original sentences. This 'trick' affacts the convolution outputs at the ends of each slice.
In the 'masked pooling' version, we do not slice the input sentence. Instead, we use a zero-one masks to split outputs of convolution layer.
Theoratically speaking the later version should be the correct implementation of PCNN, but we keep the original for comparison.
Dataset is available as 'origin_data.tar.gz'. Extract this file and run 'initial.py' to get training data.
- Tensorflow 1.4
- Python 3.5.2
Distant Supervision for Relation Extraction via Piecewise Convolutional Neural Networks http://www.emnlp2015.org/proceedings/EMNLP/pdf/EMNLP203.pdf