Datasets:

Modalities:
Text
Formats:
parquet
Languages:
Polish
ArXiv:
Libraries:
Datasets
pandas
License:
mkozlowski commited on
Commit
2b2d987
·
verified ·
1 Parent(s): cded5f2

Delete loading script

Browse files
Files changed (1) hide show
  1. PUGG_IR.py +0 -93
PUGG_IR.py DELETED
@@ -1,93 +0,0 @@
1
- import json
2
- import os
3
-
4
- import datasets
5
-
6
- logger = datasets.logging.get_logger(__name__)
7
-
8
- _CORPUS = "corpus"
9
- _QUERIES = "queries"
10
- _QRELS = "qrels"
11
-
12
- URL = ""
13
- _URLs = {
14
- _CORPUS: f"corpus.jsonl",
15
- _QUERIES: f"queries.jsonl",
16
- _QRELS: f"qrels/test.tsv",
17
- }
18
-
19
-
20
- class PuggIr(datasets.GeneratorBasedBuilder):
21
-
22
- BUILDER_CONFIGS = [
23
- datasets.BuilderConfig(
24
- name=_CORPUS,
25
- ),
26
- datasets.BuilderConfig(
27
- name=_QUERIES,
28
- ),
29
- datasets.BuilderConfig(
30
- name=_QRELS,
31
- ),
32
- ]
33
-
34
- def _info(self):
35
- if self.config.name == _CORPUS:
36
- features = datasets.Features(
37
- {
38
- "_id": datasets.Value("string"),
39
- "title": datasets.Value("string"),
40
- "text": datasets.Value("string"),
41
- }
42
- )
43
- elif self.config.name == _QUERIES:
44
- features = datasets.Features(
45
- {
46
- "_id": datasets.Value("string"),
47
- "text": datasets.Value("string"),
48
- }
49
- )
50
- elif self.config.name == _QRELS:
51
- features = datasets.Features(
52
- {
53
- "query-id": datasets.Value("string"),
54
- "corpus-id": datasets.Value("string"),
55
- "score": datasets.Value("int32"),
56
- }
57
- )
58
-
59
- return datasets.DatasetInfo(
60
- features=features,
61
- )
62
-
63
- def _split_generators(self, dl_manager):
64
- """Returns SplitGenerators."""
65
- my_urls = _URLs[self.config.name]
66
- data_dir = dl_manager.download_and_extract(my_urls)
67
-
68
- return [
69
- datasets.SplitGenerator(
70
- name=datasets.Split.TEST,
71
- gen_kwargs={"filepath": data_dir},
72
- ),
73
- ]
74
-
75
- def _generate_examples(self, filepath):
76
- """Yields examples."""
77
- if self.config.name in [_CORPUS, _QUERIES]:
78
- with open(filepath, encoding="utf-8") as f:
79
- for i, line in enumerate(f):
80
- data = json.loads(line)
81
- yield i, data
82
-
83
- elif self.config.name == _QRELS:
84
- with open(filepath, encoding="utf-8") as f:
85
- for i, line in enumerate(f):
86
- if i == 0:
87
- continue # Skip header
88
- query_id, corpus_id, score = line.strip().split("\t")
89
- yield i, {
90
- "query-id": query_id,
91
- "corpus-id": corpus_id,
92
- "score": int(score),
93
- }