Datasets:
Update arxiv_pii.py
Browse files- arxiv_pii.py +4 -4
arxiv_pii.py
CHANGED
@@ -38,11 +38,11 @@ class ArXivPII(datasets.GeneratorBasedBuilder):
|
|
38 |
example_id = 0
|
39 |
df_pages = pd.read_csv(pages_path, index_col="arxiv_id")
|
40 |
df_labels = pd.read_csv(labels_path, index_col="arxiv_id")
|
41 |
-
for
|
42 |
labels = []
|
43 |
-
if
|
44 |
-
rows = df_labels.loc[[
|
45 |
for _, e in rows.iterrows():
|
46 |
labels.append({"start": e.start, "end": e.end, "label": e.label})
|
47 |
-
yield example_id, {"text":
|
48 |
example_id += 1
|
|
|
38 |
example_id = 0
|
39 |
df_pages = pd.read_csv(pages_path, index_col="arxiv_id")
|
40 |
df_labels = pd.read_csv(labels_path, index_col="arxiv_id")
|
41 |
+
for arxiv_id, page in df_pages.iterrows():
|
42 |
labels = []
|
43 |
+
if arxiv_id in df_labels.index:
|
44 |
+
rows = df_labels.loc[[arxiv_id]]
|
45 |
for _, e in rows.iterrows():
|
46 |
labels.append({"start": e.start, "end": e.end, "label": e.label})
|
47 |
+
yield example_id, {"text": page.text, "labels": labels}
|
48 |
example_id += 1
|