small refactor
#1
by davanstrien HF Staff - opened
96 unmodified lines97989910010010110210310410510610410510610710810911011111211311011111211311411511611796 unmodified lines return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={"filepaths": [ann_file, text_file], "split": "train",}, gen_kwargs={"ann_file": ann_file, "text_file": text_file}, ), ]
def _generate_examples(self, filepaths, split): annotations = pd.read_csv(filepaths[0], dtype="object") texts = pd.read_csv(filepaths[1], dtype="object") 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 = {} data_point["extract_id"] = row["extract_id"] data_point["target"] = row["target_compound_bolded"] data_point["text"] = row["text"] 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