# sprel **Repository Path**: xinyi_chen/sprel ## Basic Information - **Project Name**: sprel - **Description**: code and data for paper: Relation as Text: A Semantic-Preserving Method for Relational Triple Extraction - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-08-20 - **Last Updated**: 2024-08-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Code Structure: -> SPRel Code --> data ----> data_raw: original dataset without our preprocess. ----> rel2id.json : all relations with their text and id. ----> data_preprocess.py : our preprocess method. ----> parser.py : SpaCy parser for preprocess ----> dataset_new.pickle : preprocessed dataset. its about 1GB! cannot upload for review ----> dataset_small.pickle : samples of preprocessed dataset. each train, valid, and test dataset for nyt, nyt_star, webnlg, webnlg_star has only 10 samples for review. use python to review them. ----> SPRelDataset.py : dataset loading module for training and testing. ----> utils.py ----> sample.txt : a single sample for review. --> model ----> Metrics.py ----> SPRelModels.py --> data_statistics.ipynb --> nyt_star_epe.ipynb : training of SPRel-EPE on nyt_star --> nyt_star_re.ipynb : training of SPRel-RE on nyt_star --> nyt_star_joint_eval.ipynb : joint evaluation for SPRel on nyt_star --> webnlg_star_epe.ipynb --> webnlg_star_re.ipynb --> webnlg_star_joint_eval.ipynb --> README Suggested Reading: 1. check data/sample.txt. this is a complete preprocessed sample. 2. (optional) check data/data_preprocess.py and data_statistics.py if you want to understand how we preprocess data. 3. (optional) check data/SPRelDataset.py. this is how we load data for training. 4. check model/SPRelModels.py. this file modifies BERT model from transformers. modifications can be easily searched by keyword ''#modified''. our models are ''BertForEntityPairExtraction'' and ''BertForRelationExtraction'' at the bottom of the file. 5. (optional) check model/Metric.py. 6. check nyt/webnlg_star_epe/re/joint_eval.ipynb in the main folder. our training and evalution details are in them Special Notice: 1. The code is only a demonstration for review with some unnecessary files deleted.