This repository contains code and resources for the paper:
Youssra Rebboud, Pasquale Lisena and Raphaël Troncy. Prompt-based Data Augmentation for Semantically-precise Event Relation Classification. Submitted at Semantic Methods for Events and Stories (SEMMES) workshop 2023
pip install -r requirements.txt
BERT\SpanBERT models fine-tuning for token And sentence classification.
To fine-tune BERT models for relation extraction, you can use the sequence_classification.py script. This script takes in a dataset of sentence pairs and their relation labels and fine-tunes a BERT model for relation classification.
To perform inference on the fine-tuned model, you can use the inference.py script. This script takes in a dataset of sentence pairs and performs relation classification using the fine-tuned BERT model.
You can download pre-trained BERT models from the following link:
To fine-tune BERT models for event extraction, you can use the weighted_loss.py script. This script takes in a dataset of sentences and their token labels and fine-tunes a BERT model for event extraction(token classification).
Replication of the paper:
Shan Zhao, Minghao Hu, Zhiping Cai, Fang Liu Modeling Dense Cross-Modal Interactions for Joint Entity-Relation Extraction. In Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence (IJCAI) Pages 4032-4038. https://doi.org/10.24963/ijcai.2020/558
Joint relation extraction and entity recognition with a Conditional random field (CRF).
Scripts for generating new sentences involving event relations, starting from FARO definitions and examples from an existing Dataset.
To generate new sentences involving event relations, you can use the following command:
python sentence_generation.pyThis script will take as input a CSV file containing a list of examples with the desired event relation, and output a new CSV file containing the newly generated sentences.
To generate event triggers for a given set of sentences, you can use the following command:
python Event_triggers_generation_by_GPT-3.pyThis script will generate the desired event triggers for the given sentences.
To clean up the generated event triggers, you can use the following command:
python answers_cleaning.pyThis script will clean the generated events from unwanted text using regular expressions output a new CSV file containing the cleaned data.
The output dataset in csv format, divided in training, test and validation.