jinmang2 commited on
Commit
cea7647
0 Parent(s):

publish version 0.0.0

Browse files
.gitattributes ADDED
@@ -0,0 +1 @@
 
 
1
+ ko_wiki_v1_squad.json filter=lfs diff=lfs merge=lfs -text
common-sense-mrc.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import pandas as pd
3
+ import datasets
4
+
5
+ _DATA_URLS = {
6
+ "train": "./ko_wiki_v1_squad.json",
7
+ }
8
+ _VERSION = "0.0.0"
9
+ _LICENSE = ""
10
+ _CITATION = ""
11
+ _HOMEPAGE = ""
12
+ _DESCRIPTION = ""
13
+
14
+
15
+ class CommonSenseMRCConfig(datasets.BuilderConfig):
16
+ def __init__(self, data_url, features, **kwargs):
17
+ super().__init__(version=datasets.Version(_VERSION, ""), **kwargs)
18
+ self.features = features
19
+ self.data_url = data_url
20
+
21
+
22
+ class CommonSenseMRC(datasets.GeneratorBasedBuilder):
23
+ DEFAULT_CONFIG_NAME = "common_sense"
24
+ BUILDER_CONFIGS = [
25
+ CommonSenseMRCConfig(
26
+ name="common_sense",
27
+ data_url=_DATA_URLS,
28
+ features=datasets.Features(
29
+ {
30
+ "answers": datasets.Sequence(
31
+ feature={
32
+ "text": datasets.Value(dtype="string"),
33
+ "answer_start": datasets.Value(dtype="int32"),
34
+ },
35
+ ),
36
+ "context": datasets.Value(dtype="string"),
37
+ "guid": datasets.Value(dtype="string"),
38
+ "question": datasets.Value(dtype="string"),
39
+ "title": datasets.Value(dtype="string"),
40
+ }
41
+ )
42
+ ),
43
+ ]
44
+
45
+ def _info(self):
46
+ return datasets.DatasetInfo(
47
+ features=self.config.features,
48
+ description=_DESCRIPTION,
49
+ homepage=_HOMEPAGE,
50
+ citation=_CITATION,
51
+ license=_LICENSE,
52
+ )
53
+
54
+ def _split_generators(self, dl_manager):
55
+ data_path = dl_manager.download_and_extract(self.config.data_url)
56
+ return [
57
+ datasets.SplitGenerator(
58
+ name=datasets.Split.TRAIN,
59
+ # These kwargs will be passed to _generate_examples
60
+ gen_kwargs={"data_file": data_path["train"]}
61
+ ),
62
+ ]
63
+
64
+ def _generate_examples(self, data_file: str):
65
+ idx = 0
66
+ common_sense_mrc = pd.read_json(data_file)
67
+ for example in common_sense_mrc["data"].tolist():
68
+ paragraphs = example["paragraphs"]
69
+ title = example["title"]
70
+ for paragraph in paragraphs:
71
+ qas = paragraph["qas"]
72
+ context = paragraph["context"]
73
+ for qa in qas:
74
+ text = [answers["text"] for answers in qa["answers"]]
75
+ answer_start = [answers["answer_start"] for answers in qa["answers"]]
76
+ features = {
77
+ "guid": str(qa["id"]),
78
+ "question": qa["question"],
79
+ "answers": {"text": text, "answer_start": answer_start},
80
+ "context": context,
81
+ "title": title,
82
+ }
83
+ yield idx, features
84
+ idx += 1
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"common_sense": {"description": "", "citation": "", "homepage": "", "license": "", "features": {"answers": {"feature": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "answer_start": {"dtype": "int32", "id": null, "_type": "Value"}}, "length": -1, "id": null, "_type": "Sequence"}, "context": {"dtype": "string", "id": null, "_type": "Value"}, "guid": {"dtype": "string", "id": null, "_type": "Value"}, "question": {"dtype": "string", "id": null, "_type": "Value"}, "title": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "common_sense_mrc", "config_name": "common_sense", "version": {"version_str": "0.0.0", "description": "", "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 116481618, "num_examples": 100268, "dataset_name": "common_sense_mrc"}}, "download_checksums": {"./ko_wiki_v1_squad.json": {"num_bytes": 93089017, "checksum": "a5a4af725210ce03a57106340f4eb248d94d23ec33030a18cc8f6c17d313f11e"}}, "download_size": 93089017, "post_processing_size": null, "dataset_size": 116481618, "size_in_bytes": 209570635}}
ko_wiki_v1_squad.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5a4af725210ce03a57106340f4eb248d94d23ec33030a18cc8f6c17d313f11e
3
+ size 93089017