schlevik
commited on
Commit
•
9192d01
1
Parent(s):
6dad2a1
change the bigbio text format to correct text
Browse files
psytar.py
CHANGED
@@ -41,6 +41,7 @@ This dataset can be used for:
|
|
41 |
In the source schema, systematic annotation with UMLS and SNOMED-CT concepts are provided.
|
42 |
"""
|
43 |
|
|
|
44 |
import re
|
45 |
from dataclasses import dataclass
|
46 |
from pathlib import Path
|
@@ -486,14 +487,14 @@ class PsyTARDataset(datasets.GeneratorBasedBuilder):
|
|
486 |
example = {
|
487 |
"id": idx,
|
488 |
"document_id": f"{row['drug_id']}_{row['sentence_index']}",
|
489 |
-
"text": row
|
490 |
-
"labels": row["
|
491 |
}
|
492 |
yield example
|
493 |
|
494 |
def _generate_examples(self, filepath) -> Tuple[int, Dict]:
|
495 |
"""Yields examples as (key, example) tuples."""
|
496 |
-
|
497 |
if self.config.schema == "source":
|
498 |
examples = self._convert_xlsx_to_source(filepath)
|
499 |
|
|
|
41 |
In the source schema, systematic annotation with UMLS and SNOMED-CT concepts are provided.
|
42 |
"""
|
43 |
|
44 |
+
import os
|
45 |
import re
|
46 |
from dataclasses import dataclass
|
47 |
from pathlib import Path
|
|
|
487 |
example = {
|
488 |
"id": idx,
|
489 |
"document_id": f"{row['drug_id']}_{row['sentence_index']}",
|
490 |
+
"text": row.sentences,
|
491 |
+
"labels": row["label"],
|
492 |
}
|
493 |
yield example
|
494 |
|
495 |
def _generate_examples(self, filepath) -> Tuple[int, Dict]:
|
496 |
"""Yields examples as (key, example) tuples."""
|
497 |
+
filepath = os.path.join(filepath, "PsyTAR_dataset.xlsx")
|
498 |
if self.config.schema == "source":
|
499 |
examples = self._convert_xlsx_to_source(filepath)
|
500 |
|