Datasets:
Tasks:
Text Retrieval
Modalities:
Text
Formats:
json
Sub-tasks:
document-retrieval
Size:
100K - 1M
Tags:
ir-datasets
License:
Delete csl.py
Browse files
csl.py
DELETED
|
@@ -1,45 +0,0 @@
|
|
| 1 |
-
import gzip
|
| 2 |
-
import json
|
| 3 |
-
import datasets
|
| 4 |
-
|
| 5 |
-
_URLS = {
|
| 6 |
-
"csl": "https://huggingface.co/datasets/neuclir/csl/resolve/main/data/csl.jsonl.gz",
|
| 7 |
-
"en_translation": "https://huggingface.co/datasets/neuclir/csl/resolve/main/data/csl.gt.063023.jsonl.gz",
|
| 8 |
-
}
|
| 9 |
-
|
| 10 |
-
class Csl(datasets.GeneratorBasedBuilder):
|
| 11 |
-
VERSION = datasets.Version("1.1.1")
|
| 12 |
-
|
| 13 |
-
def _info(self):
|
| 14 |
-
return datasets.DatasetInfo(
|
| 15 |
-
features=datasets.Features({
|
| 16 |
-
"doc_id": datasets.Value("string"),
|
| 17 |
-
"title": datasets.Value("string"),
|
| 18 |
-
"abstract": datasets.Value("string"),
|
| 19 |
-
"keywords": datasets.Sequence(feature=datasets.Value("string"), length=-1),
|
| 20 |
-
"category": datasets.Value("string"),
|
| 21 |
-
"category_eng": datasets.Value("string"),
|
| 22 |
-
"discipline": datasets.Value("string"),
|
| 23 |
-
"discipline_eng": datasets.Value("string"),
|
| 24 |
-
}),
|
| 25 |
-
)
|
| 26 |
-
|
| 27 |
-
def _split_generators(self, dl_manager):
|
| 28 |
-
paths = dl_manager.download(_URLS)
|
| 29 |
-
return [
|
| 30 |
-
datasets.SplitGenerator(
|
| 31 |
-
name=split,
|
| 32 |
-
gen_kwargs={
|
| 33 |
-
"filepath": paths[split],
|
| 34 |
-
})
|
| 35 |
-
for split in _URLS
|
| 36 |
-
]
|
| 37 |
-
|
| 38 |
-
def _generate_examples(self, filepath):
|
| 39 |
-
with gzip.open(filepath) as f:
|
| 40 |
-
for key, row in enumerate(f):
|
| 41 |
-
data = json.loads(row)
|
| 42 |
-
if "category_eng" not in data:
|
| 43 |
-
data["category_eng"] = ""
|
| 44 |
-
data["discipline_eng"] = ""
|
| 45 |
-
yield key, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|