Commit ·
51e4195
1
Parent(s): 8fa3434
small refactor
Browse files96 unmodified lines97989910010110210310410510610710810911011111211311411511696 unmodified linesreturn [datasets.SplitGenerator(name=datasets.Split.TRAIN,gen_kwargs={"filepaths": [ann_file, text_file], "split": "train",},),]def _generate_examples(self, filepaths, split):annotations = pd.read_csv(filepaths[0], dtype="object")texts = pd.read_csv(filepaths[1], dtype="object")annotations.fillna("", inplace=True)texts.fillna("", inplace=True)for _, row in texts.iterrows():data_point = {}data_point["extract_id"] = row["extract_id"]data_point["target"] = row["target_compound_bolded"]data_point["text"] = row["text"]annotator_responses = annotations[annotations["extract_id"] == row["extract_id"]]96 unmodified lines97989910010110210310410510610710810911011111211311411511611796 unmodified linesreturn [datasets.SplitGenerator(name=datasets.Split.TRAIN,gen_kwargs={"ann_file": ann_file, "text_file": text_file},),]def _generate_examples(self, ann_file, text_file):annotations = pd.read_csv(open(ann_file), dtype="object")texts = pd.read_csv(open(text_file), dtype="object")annotations.fillna("", inplace=True)texts.fillna("", inplace=True)for _, row in texts.iterrows():data_point = {"extract_id": row["extract_id"],"target": row["target_compound_bolded"],"text": row["text"],}annotator_responses = annotations[annotations["extract_id"] == row["extract_id"]]
contentious_contexts.py+9-8