vosadcii commited on
Commit
1abae9b
1 Parent(s): 73cad4a
Files changed (4) hide show
  1. README.md +159 -0
  2. dataset_info.json +1 -0
  3. policies-qa-training.json +0 -0
  4. policies.py +99 -0
README.md ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators: []
3
+ language:
4
+ - en
5
+ language_creators: []
6
+ license: []
7
+ multilinguality:
8
+ - monolingual
9
+ pretty_name: PoliciesQA
10
+ size_categories: []
11
+ source_datasets: []
12
+ tags: []
13
+ task_categories:
14
+ - question-answering
15
+ task_ids:
16
+ - extractive-qa
17
+ dataset_info:
18
+ features:
19
+ - name: context
20
+ dtype: string
21
+ - name: question
22
+ dtype: string
23
+ - name: answers
24
+ sequence:
25
+ - name: text
26
+ dtype: string
27
+ - name: answer_start
28
+ dtype: int32
29
+ config_name: plain_text
30
+ splits:
31
+ - name: train
32
+ num_bytes: 1305279
33
+ num_examples: 13480
34
+ download_size: 0
35
+ dataset_size: 1305279
36
+ ---
37
+
38
+ # Dataset Card for [Dataset Name]
39
+
40
+ ## Table of Contents
41
+ - [Dataset Card for \[Dataset Name\]](#dataset-card-for-dataset-name)
42
+ - [Table of Contents](#table-of-contents)
43
+ - [Dataset Description](#dataset-description)
44
+ - [Dataset Summary](#dataset-summary)
45
+ - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
46
+ - [Languages](#languages)
47
+ - [Dataset Structure](#dataset-structure)
48
+ - [Data Instances](#data-instances)
49
+ - [Data Fields](#data-fields)
50
+ - [Data Splits](#data-splits)
51
+ - [Dataset Creation](#dataset-creation)
52
+ - [Curation Rationale](#curation-rationale)
53
+ - [Source Data](#source-data)
54
+ - [Initial Data Collection and Normalization](#initial-data-collection-and-normalization)
55
+ - [Who are the source language producers?](#who-are-the-source-language-producers)
56
+ - [Annotations](#annotations)
57
+ - [Annotation process](#annotation-process)
58
+ - [Who are the annotators?](#who-are-the-annotators)
59
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
60
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
61
+ - [Social Impact of Dataset](#social-impact-of-dataset)
62
+ - [Discussion of Biases](#discussion-of-biases)
63
+ - [Other Known Limitations](#other-known-limitations)
64
+ - [Additional Information](#additional-information)
65
+ - [Dataset Curators](#dataset-curators)
66
+ - [Licensing Information](#licensing-information)
67
+ - [Citation Information](#citation-information)
68
+
69
+ ## Dataset Description
70
+
71
+ - **Homepage:**
72
+ - **Repository:**
73
+ - **Paper:**
74
+ - **Leaderboard:**
75
+ - **Point of Contact:**
76
+
77
+ ### Dataset Summary
78
+
79
+ [More Information Needed]
80
+
81
+ ### Supported Tasks and Leaderboards
82
+
83
+ [More Information Needed]
84
+
85
+ ### Languages
86
+
87
+ [More Information Needed]
88
+
89
+ ## Dataset Structure
90
+
91
+ ### Data Instances
92
+
93
+ [More Information Needed]
94
+
95
+ ### Data Fields
96
+
97
+ [More Information Needed]
98
+
99
+ ### Data Splits
100
+
101
+ [More Information Needed]
102
+
103
+ ## Dataset Creation
104
+
105
+ ### Curation Rationale
106
+
107
+ [More Information Needed]
108
+
109
+ ### Source Data
110
+
111
+ #### Initial Data Collection and Normalization
112
+
113
+ [More Information Needed]
114
+
115
+ #### Who are the source language producers?
116
+
117
+ [More Information Needed]
118
+
119
+ ### Annotations
120
+
121
+ #### Annotation process
122
+
123
+ [More Information Needed]
124
+
125
+ #### Who are the annotators?
126
+
127
+ [More Information Needed]
128
+
129
+ ### Personal and Sensitive Information
130
+
131
+ [More Information Needed]
132
+
133
+ ## Considerations for Using the Data
134
+
135
+ ### Social Impact of Dataset
136
+
137
+ [More Information Needed]
138
+
139
+ ### Discussion of Biases
140
+
141
+ [More Information Needed]
142
+
143
+ ### Other Known Limitations
144
+
145
+ [More Information Needed]
146
+
147
+ ## Additional Information
148
+
149
+ ### Dataset Curators
150
+
151
+ [More Information Needed]
152
+
153
+ ### Licensing Information
154
+
155
+ [More Information Needed]
156
+
157
+ ### Citation Information
158
+
159
+ [More Information Needed]
dataset_info.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"description": "Manually generated dataset for policies qa\n", "citation": "", "homepage": "ineract.com", "license": "", "features": {"context": {"dtype": "string", "_type": "Value"}, "question": {"dtype": "string", "_type": "Value"}, "answers": {"feature": {"text": {"dtype": "string", "_type": "Value"}, "answer_start": {"dtype": "int32", "_type": "Value"}}, "_type": "Sequence"}}, "task_templates": [{"task": "question-answering-extractive"}], "builder_name": "policies-qa", "config_name": "plain_text", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 1305279, "num_examples": 13480, "dataset_name": "policies-qa"}}, "download_checksums": {}, "download_size": 0, "dataset_size": 1305279, "size_in_bytes": 1305279}
policies-qa-training.json ADDED
The diff for this file is too large to render. See raw diff
 
policies.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+
3
+ import datasets
4
+ from datasets.tasks import QuestionAnsweringExtractive
5
+
6
+
7
+ logger = datasets.logging.get_logger(__name__)
8
+
9
+ _DESCRIPTION = """\
10
+ Manually generated dataset for policies qa
11
+ """
12
+
13
+ _URLS = {
14
+ "train": "policies-qa-training.json"
15
+ }
16
+
17
+
18
+ class PoliciesQAConfig(datasets.BuilderConfig):
19
+ """BuilderConfig for Ineract Policies."""
20
+
21
+ def __init__(self, **kwargs):
22
+ """BuilderConfig for Ineract Policies.
23
+ Args:
24
+ **kwargs: keyword arguments forwarded to super.
25
+ """
26
+ super(PoliciesQAConfig, self).__init__(**kwargs)
27
+
28
+
29
+ class PoliciesQA(datasets.GeneratorBasedBuilder):
30
+ """Ineract Policies: The Policy Question Answering Dataset. Version 0.1"""
31
+
32
+ BUILDER_CONFIGS = [
33
+ PoliciesQAConfig(
34
+ name="plain_text",
35
+ version=datasets.Version("1.0.0", ""),
36
+ description="Plain text",
37
+ ),
38
+ ]
39
+
40
+ DEFAULT_CONFIG_NAME = "plain_text"
41
+
42
+ def _info(self):
43
+ return datasets.DatasetInfo(
44
+ description=_DESCRIPTION,
45
+ features=datasets.Features(
46
+ {
47
+ "context": datasets.Value("string"),
48
+ "question": datasets.Value("string"),
49
+ "answers": datasets.features.Sequence(
50
+ {
51
+ "text": datasets.Value("string"),
52
+ "answer_start": datasets.Value("int32"),
53
+ }
54
+ ),
55
+ }
56
+ ),
57
+ # No default supervised_keys (as we have to pass both question
58
+ # and context as input).
59
+ supervised_keys=None,
60
+ homepage="ineract.com",
61
+ task_templates=[
62
+ QuestionAnsweringExtractive(
63
+ question_column="question", context_column="context", answers_column="answers"
64
+ )
65
+ ],
66
+ )
67
+
68
+ def _split_generators(self, dl_manager):
69
+ downloaded_files = dl_manager.extract(_URLS)
70
+
71
+ return [
72
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={
73
+ "filepath": downloaded_files["train"]})
74
+ ]
75
+
76
+ def _generate_examples(self, filepath):
77
+ """This function returns the examples in the raw (text) form."""
78
+ logger.info("generating examples from = %s", filepath)
79
+ key = 0
80
+ with open(filepath, encoding="utf-8") as f:
81
+ policies = json.load(f)
82
+ for policy in policies["data"]:
83
+ context = policy["context"]
84
+ question = policy["question"]
85
+ answer_starts = [answer_start
86
+ for answer_start in policy["answers"]["answer_start"]]
87
+ answers = [
88
+ answer_text for answer_text in policy["answers"]["text"]]
89
+ # Features currently used are "context", "question", and "answers".
90
+ # Others are extracted here for the ease of future expansions.
91
+ yield key, {
92
+ "context": context,
93
+ "question": question,
94
+ "answers": {
95
+ "answer_start": answer_starts,
96
+ "text": answers,
97
+ },
98
+ }
99
+ key += 1