Anery / RSAN

Source code for IJCAI 2020 paper "A Relation-Specific Attention Network for Joint Entity and Relation Extraction"
50 stars 12 forks source link

Source code for IJCAI 2020 paper "A Relation-Specific Attention Network for Joint Entity and Relation Extraction"

Prerequisites

Code

├── config.py
├── data
├── DataLoader.py
├── data_prepare.py
├── eval_utils.py
├── misc
│   ├── init.py
│   ├── LossWrapper.py
│   └── utils.py
├── model
│   ├── init.py
│   └── Rel_based_labeling.py
├── networks
│   ├── decoder.py
│   ├── embedding.py
│   ├── encoder.py
│   └── init.py
├── Test.py
└── train.py

Descriptions

data/multiNYT/util.py

Process raw data to obtain word dict (word.npy),relation dict(rel2id.json),label dict(label2id.json) and so on.

Labels:["S-H", "S-T", "B-H", "B-T", "I-H", "I-T", "E-H", "E-T", "O", "X"]

Tag H and T stand for head and tail respectively, tag O stands for irrelevant tokens in the sentence, and tag X is padding signal.

data_prepare.py

Convert the original input data into the form of model input and save as .pkl files.

See the example below.

DataLoader.py

Construct dataloader from .pkl files stored in the previous step. Note that our batch_size refers to the number of sentences, one sentence corresponds to $n{pos}+n{neg}$ training samples, so you may find that the number of training samples in different batches are different.

Run

Citation

@inproceedings{ijcai2020-561,
  title     = {A Relation-Specific Attention Network for Joint Entity and Relation Extraction},
  author    = {Yuan, Yue and Zhou, Xiaofei and Pan, Shirui and Zhu, Qiannan and Song, Zeliang and Guo, Li},
  booktitle = {Proceedings of the Twenty-Ninth International Joint Conference on
               Artificial Intelligence, {IJCAI-20}},
  publisher = {International Joint Conferences on Artificial Intelligence Organization},             
  editor    = {Christian Bessiere}, 
  pages     = {4054--4060},
  year      = {2020},
  month     = {7},
  note      = {Main track},
  doi       = {10.24963/ijcai.2020/561},
  url       = {https://doi.org/10.24963/ijcai.2020/561},
}