Coder Social home page Coder Social logo

zjunlp / rap Goto Github PK

View Code? Open in Web Editor NEW
39.0 7.0 3.0 17.56 MB

[SIGIR 2023] Schema-aware Reference as Prompt Improves Data-Efficient Knowledge Graph Construction

License: MIT License

Python 98.67% Shell 1.33%
event-extraction knowledge-graph knowledge-informed-prompt-learning prompt relation-extraction relational-triple-extraction retrieval triple-extraction data-efficient few-shot

rap's Introduction

RAP

Code for the SIGIR2023 paper "Schema-aware Reference as Prompt Improves Data-Efficient Knowledge Graph Construction".

Requirements

Java 8 # for elasticsearch
elasticsearch==7.17.1

Retrieving for Reference

The reference store can be downloaded from here. Unzip the file and put the folder store/ into retrieval/ folder, and the final directory structure is as follows:

retrieval
├── store/
├── retrieve.py
└── retrieve_utils.py

For different base models, you can generate the reference by following codes:

cd retrieval/ 
python retrieve.py --base_model prgc

The parameter --base_model is for different base models, we can change it in prgc, relationprompt, t2e, degree.

For Text2Event and DEGREE, please follow the instruction README.md document in their corresponding folder to preprocess the datasets, and then generate the retrieved reference.

BaseModel

We plugged RAP to several base models, which can be seen in the folders below:

BaseModel
├── DEGREE
├── PRGC
├── RelationPrompt
└── Text2Event

The code of above base models are borrowed from their original codes with slight modifacations.

DEGREE : Please follow the instruction here.

PRGC : Please follow the instruction here.

RelationPrompt : Please follow the instruction here.

Text2Event : Please follow the instruction here.

rap's People

Contributors

shengyumao avatar zxlzr 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

rap's Issues

retrieve.py

D:\Users\ShuaiqiDuan\Desktop\Research\DL\NLP_Pytorch\RAP\RAP\retrieval\retrieve.py:14: DeprecationWarning: Using positional arguments for APIs is deprecated and will be disabled in 8.0.0. Instead use only keyword arguments for all APIs. See elastic/elasticsearch-py#1698 for more information
if es.indices.exists(index_name):
E:\anaconda\envs\PyTorch\lib\site-packages\elasticsearch\connection\base.py:200: ElasticsearchWarning: Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html to enable security.
warnings.warn(message, category=ElasticsearchWarning)
Traceback (most recent call last):
File "D:\Users\ShuaiqiDuan\Desktop\Research\DL\NLP_Pytorch\RAP\RAP\retrieval\retrieve.py", line 180, in
construct_store(es, data_name)
File "D:\Users\ShuaiqiDuan\Desktop\Research\DL\NLP_Pytorch\RAP\RAP\retrieval\retrieve.py", line 17, in construct_store
data = read_data_from_file(file_name=file_name)
File "D:\Users\ShuaiqiDuan\Desktop\Research\DL\NLP_Pytorch\RAP\RAP\retrieval\retrieve_utils.py", line 59, in read_data_from_file
inputs = open('store/' + file_name, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'store/nyt_store.json'
how can i solve it ?

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.