Delete qrel.py
Browse files
qrel.py
DELETED
|
@@ -1,75 +0,0 @@
|
|
| 1 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
-
#
|
| 3 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
-
# you may not use this file except in compliance with the License.
|
| 5 |
-
# You may obtain a copy of the License at
|
| 6 |
-
#
|
| 7 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
-
#
|
| 9 |
-
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
-
# See the License for the specific language governing permissions and
|
| 13 |
-
# limitations under the License.
|
| 14 |
-
|
| 15 |
-
import json
|
| 16 |
-
import lzma
|
| 17 |
-
import os
|
| 18 |
-
|
| 19 |
-
import datasets
|
| 20 |
-
try:
|
| 21 |
-
import lzma as xz
|
| 22 |
-
except ImportError:
|
| 23 |
-
import pylzma as xz
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
_URLS = {
|
| 27 |
-
"full": "https://huggingface.co/datasets/Stern5497/qrel/resolve/main",
|
| 28 |
-
}
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
class Qrel(datasets.GeneratorBasedBuilder):
|
| 32 |
-
"""."""
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
BUILDER_CONFIGS = [
|
| 36 |
-
datasets.BuilderConfig(name="full", description="This part covers the whole dataset"),
|
| 37 |
-
]
|
| 38 |
-
|
| 39 |
-
DEFAULT_CONFIG_NAME = "full" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 40 |
-
|
| 41 |
-
def _info(self):
|
| 42 |
-
if self.config.name == "full":
|
| 43 |
-
features = datasets.Features(
|
| 44 |
-
{
|
| 45 |
-
"id": datasets.Value("string"),
|
| 46 |
-
"corp_id": datasets.Value("string"),
|
| 47 |
-
"match": datasets.Value("string"),
|
| 48 |
-
"language": datasets.Value("string"),
|
| 49 |
-
}
|
| 50 |
-
)
|
| 51 |
-
return datasets.DatasetInfo(
|
| 52 |
-
description="",
|
| 53 |
-
features=features, # Here we define them above because they are different between the two configurations
|
| 54 |
-
)
|
| 55 |
-
|
| 56 |
-
def _split_generators(self, dl_manager):
|
| 57 |
-
urls = _URLS[self.config.name]
|
| 58 |
-
filepath = dl_manager.download(os.path.join(urls, "qrels_all.jsonl"))
|
| 59 |
-
return [
|
| 60 |
-
datasets.SplitGenerator(
|
| 61 |
-
name=datasets.Split.TRAIN,
|
| 62 |
-
# These kwargs will be passed to _generate_examples
|
| 63 |
-
gen_kwargs={
|
| 64 |
-
"filepath": filepath,
|
| 65 |
-
"split": "train",
|
| 66 |
-
},
|
| 67 |
-
)
|
| 68 |
-
]
|
| 69 |
-
|
| 70 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 71 |
-
def _generate_examples(self, filepath, split):
|
| 72 |
-
with open(filepath, encoding="utf-8") as f:
|
| 73 |
-
for id_, row in enumerate(f):
|
| 74 |
-
data = json.loads(row)
|
| 75 |
-
yield id_, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|