Giter Club home page Giter Club logo

mnre's Introduction

Neural Relation Extraction with Multi-lingual Attention (MNRE)

Neural relation extraction aims to extract relations from plain text with neural models, which has been the state-of-the-art methods for relation extraction. In this project, we provide our implementations of CNN [Zeng et al., 2014] and PCNN [Zeng et al.,2015] and their extended version with multi-lingual sentence-level attention scheme [Lin et al., 2017] .

Data

We provide the dataset we used for the task relation extraction in (https://pan.baidu.com/s/1dF26l93). We preprocess the original data to make it satisfy the input format of our codes.

Pre-Trained English Word Vectors are learned from New York Times Annotated Corpus (LDC Data LDC2008T19), which should be obtained from LDC (https://catalog.ldc.upenn.edu/LDC2008T19).

Pre-Trained Chinese Word Vectors are learned from Chinese Baidu Baike (https://baike.baidu.com/).

To run our code, the dataset should be put in the folder data/ using the following format, containing six files

  • train_en.txt / train_zh.txt: training file, format (wikidata_qid_e1, wikidata_qid_e2, e1_name, e2_name, relation, sentence).

  • valid_en.txt / valid_zh.txt: validation file, same format as train.txt

  • test_en.txt / test_zh.txt: test file, same format as train.txt.

  • entity2id.txt: all entities and corresponding ids, one per line.

  • relation2id.txt: all relations and corresponding ids, one per line.

  • vec_en.bin, vec_zh.bin: the pre-train word embedding file

Codes

The source codes of various methods are put in the folders src/.

Compile

Just type "make" in the folder src/.

Train

For training, you need to type the following command in each model folder:

./train

The training model file will be saved in folder out/ .

Test

For testing, you need to type the following command in each model folder:

./test

The testing result which reports the precision/recall curve will be shown in pr.txt.

Cite

If you use the code, please cite the following paper:

[Lin et al., 2017] Yankai Lin, Zhiyuan Liu, and Maosong Sun. Neural Relation Extraction with Multi-lingual Attention. In Proceedings of ACL.[pdf]

Reference

[Zeng et al., 2014] Daojian Zeng, Kang Liu, Siwei Lai, Guangyou Zhou, and Jun Zhao. Relation classification via convolutional deep neural network. In Proceedings of COLING.

[Zeng et al.,2015] Daojian Zeng,Kang Liu,Yubo Chen,and Jun Zhao. Distant supervision for relation extraction via piecewise convolutional neural networks. In Proceedings of EMNLP.

[Lin et al., 2016] Yankai Lin, Shiqi Shen, Zhiyuan Liu, Huanbo Luan, and Maosong Sun. Neural Relation Extraction with Selective Attention over Instances. In Proceedings of ACL.[pdf]

mnre's People

Contributors

mrlyk423 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mnre's Issues

a new issue

what is mean the code "if(res !=res)",in my opinion,program will never operate it in train.cpp of cnn file!

An error “fprintf_chk.c: No such file or directory” occurs

您好,
When I execute the original code under Ubuntu 14.04., the error occurs:

Segmentation fault (core dumped)

Then, I tried to debug it with gdb, and got the following error:

The program received signal SIGSEGV, Segmentation fault.
___fprintf_chk (fp=0x0, flag=1, format=0x4155c6 "%d\n") at fprintf_chk.c:30
30      fprintf_chk.c: No such file or directory.

I have googled a lot, and find no solution, could you give me some advice to resolve that.

Thanks so much.

Kind Regards.

Segmentation fault (core dumped)

gpuws@gpuws32g:/ub16_prj/MNRE/src/MNRE_CNN$ ./train
1 4 3 1 5 1 4 0 3 1 Init Begin.
Begin_init_para
relationTotal: 176
End_init_para
Begin read data of language: zh
wordTotal= 4756241
Word dimension= 50
240
End read data of language: zh
Begin read data of language: en
wordTotal= 1067259
Word dimension= 50
240
End read data of language: en
540098 537992
Init End.
959935
npoch: 187/1874
time(s): 394.44
score: -135516 95744
npoch: 374/1874
time(s): 395.614
score: -111949 191488
npoch: 561/1874
time(s): 421.19
score: -108274 287232
npoch: 748/1874
time(s): 497.307
score: -104558 382976
npoch: 935/1874
time(s): 799.708
score: -100079 478720
npoch: 1122/1874
time(s): 727.027
score: -94617.7 574464
npoch: 1309/1874
time(s): 778.266
score: -88565.3 670208
npoch: 1496/1874
time(s): 661.395
score: -82241.4 765952
npoch: 1683/1874
time(s): 634.374
score: -77362.2 861696
npoch: 1870/1874
time(s): 585.224
score: -73005.4 957440
Total Score: -977725.375000
test
version=1
tot: 47638 537992
94148600
precision: 0 recall: 0
precision: 0.0738523 recall: 0.000776691
precision: 0.0849151 recall: 0.00178429
precision: 0.0852765 recall: 0.00268693
precision: 0.0894553 recall: 0.0037575
precision: 0.0903639 recall: 0.00474411
precision: 0.0943019 recall: 0.00594064
precision: 0.0945444 recall: 0.00694823
precision: 0.0977256 recall: 0.00820773
precision: 0.0986447 recall: 0.00932029
precision: 0.09978 recall: 0.0104748
precision: 0.100709 recall: 0.0116294
precision: 0.10215 recall: 0.0128679
precision: 0.1026 recall: 0.0140014
precision: 0.103414 recall: 0.015198
precision: 0.103586 recall: 0.0163105
precision: 0.103487 recall: 0.0173811
precision: 0.102576 recall: 0.0183047
precision: 0.101989 recall: 0.0192703
precision: 0.102726 recall: 0.0204878
1
Segmentation fault (core dumped)
gpuws@gpuws32g:
/ub16_prj/MNRE/src/MNRE_CNN$

关于PR曲线

你好,
能否上传一份关于这篇论文Neural Relation Extraction with Multi-lingual Attention中汇报的P/R曲线的数据。
谢谢!

Segmentation fault

When I was doing the training step,It came a problem with "Segmentation fault".Have you met it before?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.