Commit
·
bd6256d
0
Parent(s):
Update files from the datasets library (from 1.0.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.0.0
- .gitattributes +27 -0
- dataset_infos.json +1 -0
- dummy/0.1.0/dummy_data.zip +3 -0
- jeopardy.py +104 -0
.gitattributes
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bin.* filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
20 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
26 |
+
*.zstandard filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
dataset_infos.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"default": {"description": "\nDataset containing 216,930 Jeopardy questions, answers and other data.\n\nThe json file is an unordered list of questions where each question has\n'category' : the question category, e.g. \"HISTORY\"\n'value' : integer $ value of the question as string, e.g. \"200\"\nNote: This is \"None\" for Final Jeopardy! and Tiebreaker questions\n'question' : text of question\nNote: This sometimes contains hyperlinks and other things messy text such as when there's a picture or video question\n'answer' : text of answer\n'round' : one of \"Jeopardy!\",\"Double Jeopardy!\",\"Final Jeopardy!\" or \"Tiebreaker\"\nNote: Tiebreaker questions do happen but they're very rare (like once every 20 years)\n'show_number' : int of show number, e.g '4680'\n'air_date' : string of the show air date in format YYYY-MM-DD\n", "citation": "\n", "homepage": "https://www.reddit.com/r/datasets/comments/1uyd0t/200000_jeopardy_questions_in_a_json_file/", "license": "", "features": {"category": {"dtype": "string", "id": null, "_type": "Value"}, "air_date": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "value": {"dtype": "int32", "id": null, "_type": "Value"}, "answer": {"dtype": "string", "id": null, "_type": "Value"}, "round": {"dtype": "string", "id": null, "_type": "Value"}, "show_number": {"dtype": "int32", "id": null, "_type": "Value"}}, "supervised_keys": null, "builder_name": "jeopardy", "config_name": "default", "version": {"version_str": "0.1.0", "description": null, "datasets_version_to_prepare": null, "major": 0, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 36132636, "num_examples": 216930, "dataset_name": "jeopardy"}}, "download_checksums": {"http://skeeto.s3.amazonaws.com/share/JEOPARDY_QUESTIONS1.json.gz": {"num_bytes": 12721082, "checksum": "e031eeab6eecc1f36efe7addb01cef2cd3623da16cd0e5de7c4661cf11dbd4f0"}}, "download_size": 12721082, "dataset_size": 36132636, "size_in_bytes": 48853718}}
|
dummy/0.1.0/dummy_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4fe5e77d4424a5ba9531001280901ffcbcd2b89408dfdbd585f060fbae0d48cb
|
3 |
+
size 571
|
jeopardy.py
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""TODO(jeopardy): Add a description here."""
|
2 |
+
|
3 |
+
from __future__ import absolute_import, division, print_function
|
4 |
+
|
5 |
+
import json
|
6 |
+
|
7 |
+
import datasets
|
8 |
+
|
9 |
+
|
10 |
+
# TODO(jeopardy): BibTeX citation
|
11 |
+
_CITATION = """
|
12 |
+
"""
|
13 |
+
|
14 |
+
# TODO(jeopardy):
|
15 |
+
_DESCRIPTION = """
|
16 |
+
Dataset containing 216,930 Jeopardy questions, answers and other data.
|
17 |
+
|
18 |
+
The json file is an unordered list of questions where each question has
|
19 |
+
'category' : the question category, e.g. "HISTORY"
|
20 |
+
'value' : integer $ value of the question as string, e.g. "200"
|
21 |
+
Note: This is "None" for Final Jeopardy! and Tiebreaker questions
|
22 |
+
'question' : text of question
|
23 |
+
Note: This sometimes contains hyperlinks and other things messy text such as when there's a picture or video question
|
24 |
+
'answer' : text of answer
|
25 |
+
'round' : one of "Jeopardy!","Double Jeopardy!","Final Jeopardy!" or "Tiebreaker"
|
26 |
+
Note: Tiebreaker questions do happen but they're very rare (like once every 20 years)
|
27 |
+
'show_number' : int of show number, e.g '4680'
|
28 |
+
'air_date' : string of the show air date in format YYYY-MM-DD
|
29 |
+
"""
|
30 |
+
_URL = "https://www.reddit.com/r/datasets/comments/1uyd0t/200000_jeopardy_questions_in_a_json_file/"
|
31 |
+
_DATA_URL = "http://skeeto.s3.amazonaws.com/share/JEOPARDY_QUESTIONS1.json.gz"
|
32 |
+
_DATA_FILE = "JEOPARDY_QUESTIONS1.json"
|
33 |
+
|
34 |
+
|
35 |
+
class Jeopardy(datasets.GeneratorBasedBuilder):
|
36 |
+
"""TODO(jeopardy): Short description of my dataset."""
|
37 |
+
|
38 |
+
# TODO(jeopardy): Set up version.
|
39 |
+
VERSION = datasets.Version("0.1.0")
|
40 |
+
|
41 |
+
def _info(self):
|
42 |
+
# TODO(jeopardy): Specifies the datasets.DatasetInfo object
|
43 |
+
return datasets.DatasetInfo(
|
44 |
+
# This is the description that will appear on the datasets page.
|
45 |
+
description=_DESCRIPTION,
|
46 |
+
# datasets.features.FeatureConnectors
|
47 |
+
features=datasets.Features(
|
48 |
+
{
|
49 |
+
"category": datasets.Value("string"),
|
50 |
+
"air_date": datasets.Value("string"),
|
51 |
+
"question": datasets.Value("string"),
|
52 |
+
"value": datasets.Value("int32"),
|
53 |
+
"answer": datasets.Value("string"),
|
54 |
+
"round": datasets.Value("string"),
|
55 |
+
"show_number": datasets.Value("int32"),
|
56 |
+
# These are the features of your dataset like images, labels ...
|
57 |
+
}
|
58 |
+
),
|
59 |
+
# If there's a common (input, target) tuple from the features,
|
60 |
+
# specify them here. They'll be used if as_supervised=True in
|
61 |
+
# builder.as_dataset.
|
62 |
+
supervised_keys=None,
|
63 |
+
# Homepage of the dataset for documentation
|
64 |
+
homepage=_URL,
|
65 |
+
citation=_CITATION,
|
66 |
+
)
|
67 |
+
|
68 |
+
def _split_generators(self, dl_manager):
|
69 |
+
"""Returns SplitGenerators."""
|
70 |
+
# TODO(jeopardy): Downloads the data and defines the splits
|
71 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to
|
72 |
+
# download and extract URLs
|
73 |
+
filepath = dl_manager.download_and_extract(_DATA_URL)
|
74 |
+
|
75 |
+
return [
|
76 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": filepath}),
|
77 |
+
]
|
78 |
+
|
79 |
+
def _generate_examples(self, filepath):
|
80 |
+
"""Yields examples."""
|
81 |
+
# TODO(jeopardy): Yields (key, example) tuples from the dataset
|
82 |
+
with open(filepath, encoding="utf-8") as f:
|
83 |
+
data = json.load(f)
|
84 |
+
for i, example in enumerate(data):
|
85 |
+
category = example["category"]
|
86 |
+
air_date = example["air_date"]
|
87 |
+
question = example["question"]
|
88 |
+
if example["value"] is None:
|
89 |
+
value = -1 # for Final Jeopardy! and Tiebreaker questions
|
90 |
+
else:
|
91 |
+
value = int(example["value"][1:].replace(",", ""))
|
92 |
+
answer = example["answer"]
|
93 |
+
round = example["round"]
|
94 |
+
show_number = int(example["show_number"])
|
95 |
+
yield i, {
|
96 |
+
"category": category,
|
97 |
+
"air_date": air_date,
|
98 |
+
"question": question,
|
99 |
+
"value": value,
|
100 |
+
"answer": answer,
|
101 |
+
"round": round,
|
102 |
+
"category": category,
|
103 |
+
"show_number": show_number,
|
104 |
+
}
|