Datasets:
Delete dataset.py
Browse files- dataset.py +0 -44
dataset.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
import csv
|
| 2 |
-
from datasets import DatasetInfo, Features, Value, SplitGenerator, Split, GeneratorBasedBuilder
|
| 3 |
-
|
| 4 |
-
_CITATION = ""
|
| 5 |
-
_DESCRIPTION = "Medical translation pairs with semantic glosses and UMLS CUIs."
|
| 6 |
-
|
| 7 |
-
class MedicalTSV(GeneratorBasedBuilder):
|
| 8 |
-
VERSION = "1.0.0"
|
| 9 |
-
|
| 10 |
-
def _info(self):
|
| 11 |
-
return DatasetInfo(
|
| 12 |
-
description=_DESCRIPTION,
|
| 13 |
-
features=Features({
|
| 14 |
-
"sentence_id": Value("string"),
|
| 15 |
-
"src_lang": Value("string"),
|
| 16 |
-
"tgt_lang": Value("string"),
|
| 17 |
-
"gender_variant": Value("string"),
|
| 18 |
-
"source_text": Value("string"),
|
| 19 |
-
"target_text": Value("string"),
|
| 20 |
-
"semantic_gloss": Value("string"),
|
| 21 |
-
"CUI_semantic_gloss": Value("string"),
|
| 22 |
-
}),
|
| 23 |
-
citation=_CITATION,
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
-
def _split_generators(self, dl_manager):
|
| 27 |
-
# If you later add dev/test, replicate with different files or config.
|
| 28 |
-
train_path = dl_manager.manual_dir / "train.tsv"
|
| 29 |
-
return [SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": train_path})]
|
| 30 |
-
|
| 31 |
-
def _generate_examples(self, filepath):
|
| 32 |
-
with open(filepath, "r", encoding="utf-8") as f:
|
| 33 |
-
reader = csv.DictReader(f, delimiter="\t")
|
| 34 |
-
for i, row in enumerate(reader):
|
| 35 |
-
yield i, {
|
| 36 |
-
"sentence_id": row.get("sentence_id", ""),
|
| 37 |
-
"src_lang": row.get("src_lang", ""),
|
| 38 |
-
"tgt_lang": row.get("tgt_lang", ""),
|
| 39 |
-
"gender_variant": row.get("gender_variant", ""),
|
| 40 |
-
"source_text": row.get("source_text", ""),
|
| 41 |
-
"target_text": row.get("target_text", ""),
|
| 42 |
-
"semantic_gloss": row.get("semantic_gloss", ""),
|
| 43 |
-
"CUI_semantic_gloss": row.get("CUI_semantic_gloss", ""),
|
| 44 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|