Datasets:
Tasks:
Table to Text
Modalities:
Text
Languages:
English
Size:
10K - 100K
Tags:
data-to-text
License:
parquet-converter
commited on
Commit
•
c4ff731
1
Parent(s):
f91b5cc
Update parquet files
Browse files- .gitattributes +0 -35
- README.md +0 -753
- create_mlb_data.py +0 -177
- data.zip → default/mlb_data_to_text-test.parquet +2 -2
- default/mlb_data_to_text-train-00000-of-00004.parquet +3 -0
- default/mlb_data_to_text-train-00001-of-00004.parquet +3 -0
- default/mlb_data_to_text-train-00002-of-00004.parquet +3 -0
- default/mlb_data_to_text-train-00003-of-00004.parquet +3 -0
- default/mlb_data_to_text-validation.parquet +3 -0
- mlb_data_to_text.json +0 -174
- mlb_data_to_text.py +0 -478
.gitattributes
DELETED
@@ -1,35 +0,0 @@
|
|
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
|
28 |
-
*.json.bz2 filter=lfs diff=lfs merge=lfs -text
|
29 |
-
test.jsonl.bz2 filter=lfs diff=lfs merge=lfs -text
|
30 |
-
train.jsonl.bz2 filter=lfs diff=lfs merge=lfs -text
|
31 |
-
validation.jsonl.bz2 filter=lfs diff=lfs merge=lfs -text
|
32 |
-
test.jsonl filter=lfs diff=lfs merge=lfs -text
|
33 |
-
train.jsonl filter=lfs diff=lfs merge=lfs -text
|
34 |
-
validation.jsonl filter=lfs diff=lfs merge=lfs -text
|
35 |
-
data.tar.bz2 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
DELETED
@@ -1,753 +0,0 @@
|
|
1 |
-
---
|
2 |
-
annotations_creators:
|
3 |
-
- none
|
4 |
-
language_creators:
|
5 |
-
- unknown
|
6 |
-
language:
|
7 |
-
- en
|
8 |
-
license:
|
9 |
-
- other
|
10 |
-
multilinguality:
|
11 |
-
- unknown
|
12 |
-
size_categories:
|
13 |
-
- unknown
|
14 |
-
source_datasets:
|
15 |
-
- original
|
16 |
-
task_categories:
|
17 |
-
- table-to-text
|
18 |
-
task_ids: []
|
19 |
-
pretty_name: mlb_data_to_text
|
20 |
-
tags:
|
21 |
-
- data-to-text
|
22 |
-
---
|
23 |
-
|
24 |
-
# Dataset Card for GEM/mlb_data_to_text
|
25 |
-
|
26 |
-
## Dataset Description
|
27 |
-
|
28 |
-
- **Homepage:** https://github.com/ratishsp/mlb-data-scripts
|
29 |
-
- **Repository:** https://github.com/ratishsp/mlb-data-scripts
|
30 |
-
- **Paper:** https://aclanthology.org/P19-1195
|
31 |
-
- **Leaderboard:** N/A
|
32 |
-
- **Point of Contact:** Ratish Puduppully
|
33 |
-
|
34 |
-
### Link to Main Data Card
|
35 |
-
|
36 |
-
You can find the main data card on the [GEM Website](https://gem-benchmark.com/data_cards/mlb_data_to_text).
|
37 |
-
|
38 |
-
### Dataset Summary
|
39 |
-
|
40 |
-
The MLB dataset is an English sport-related data-to-text dataset in the baseball domain. The input is a large table with results of a game and the output is a description of the game.
|
41 |
-
|
42 |
-
You can load the dataset via:
|
43 |
-
```
|
44 |
-
import datasets
|
45 |
-
data = datasets.load_dataset('GEM/mlb_data_to_text')
|
46 |
-
```
|
47 |
-
The data loader can be found [here](https://huggingface.co/datasets/GEM/mlb_data_to_text).
|
48 |
-
|
49 |
-
#### website
|
50 |
-
[Github](https://github.com/ratishsp/mlb-data-scripts)
|
51 |
-
|
52 |
-
#### paper
|
53 |
-
[ACL Anthology](https://aclanthology.org/P19-1195)
|
54 |
-
|
55 |
-
#### authors
|
56 |
-
Ratish Puduppully, Li Dong, Mirella Lapata
|
57 |
-
|
58 |
-
## Dataset Overview
|
59 |
-
|
60 |
-
### Where to find the Data and its Documentation
|
61 |
-
|
62 |
-
#### Webpage
|
63 |
-
|
64 |
-
<!-- info: What is the webpage for the dataset (if it exists)? -->
|
65 |
-
<!-- scope: telescope -->
|
66 |
-
[Github](https://github.com/ratishsp/mlb-data-scripts)
|
67 |
-
|
68 |
-
#### Download
|
69 |
-
|
70 |
-
<!-- info: What is the link to where the original dataset is hosted? -->
|
71 |
-
<!-- scope: telescope -->
|
72 |
-
[Github](https://github.com/ratishsp/mlb-data-scripts)
|
73 |
-
|
74 |
-
#### Paper
|
75 |
-
|
76 |
-
<!-- info: What is the link to the paper describing the dataset (open access preferred)? -->
|
77 |
-
<!-- scope: telescope -->
|
78 |
-
[ACL Anthology](https://aclanthology.org/P19-1195)
|
79 |
-
|
80 |
-
#### BibTex
|
81 |
-
|
82 |
-
<!-- info: Provide the BibTex-formatted reference for the dataset. Please use the correct published version (ACL anthology, etc.) instead of google scholar created Bibtex. -->
|
83 |
-
<!-- scope: microscope -->
|
84 |
-
```
|
85 |
-
@inproceedings{puduppully-etal-2019-data,
|
86 |
-
title = "Data-to-text Generation with Entity Modeling",
|
87 |
-
author = "Puduppully, Ratish and
|
88 |
-
Dong, Li and
|
89 |
-
Lapata, Mirella",
|
90 |
-
booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
|
91 |
-
month = jul,
|
92 |
-
year = "2019",
|
93 |
-
address = "Florence, Italy",
|
94 |
-
publisher = "Association for Computational Linguistics",
|
95 |
-
url = "https://www.aclweb.org/anthology/P19-1195",
|
96 |
-
doi = "10.18653/v1/P19-1195",
|
97 |
-
pages = "2023--2035",
|
98 |
-
}
|
99 |
-
```
|
100 |
-
|
101 |
-
#### Contact Name
|
102 |
-
|
103 |
-
<!-- quick -->
|
104 |
-
<!-- info: If known, provide the name of at least one person the reader can contact for questions about the dataset. -->
|
105 |
-
<!-- scope: periscope -->
|
106 |
-
Ratish Puduppully
|
107 |
-
|
108 |
-
#### Contact Email
|
109 |
-
|
110 |
-
<!-- info: If known, provide the email of at least one person the reader can contact for questions about the dataset. -->
|
111 |
-
<!-- scope: periscope -->
|
112 | |
113 |
-
|
114 |
-
#### Has a Leaderboard?
|
115 |
-
|
116 |
-
<!-- info: Does the dataset have an active leaderboard? -->
|
117 |
-
<!-- scope: telescope -->
|
118 |
-
no
|
119 |
-
|
120 |
-
|
121 |
-
### Languages and Intended Use
|
122 |
-
|
123 |
-
#### Multilingual?
|
124 |
-
|
125 |
-
<!-- quick -->
|
126 |
-
<!-- info: Is the dataset multilingual? -->
|
127 |
-
<!-- scope: telescope -->
|
128 |
-
no
|
129 |
-
|
130 |
-
#### Covered Languages
|
131 |
-
|
132 |
-
<!-- quick -->
|
133 |
-
<!-- info: What languages/dialects are covered in the dataset? -->
|
134 |
-
<!-- scope: telescope -->
|
135 |
-
`English`
|
136 |
-
|
137 |
-
#### License
|
138 |
-
|
139 |
-
<!-- quick -->
|
140 |
-
<!-- info: What is the license of the dataset? -->
|
141 |
-
<!-- scope: telescope -->
|
142 |
-
other: Other license
|
143 |
-
|
144 |
-
#### Intended Use
|
145 |
-
|
146 |
-
<!-- info: What is the intended use of the dataset? -->
|
147 |
-
<!-- scope: microscope -->
|
148 |
-
The dataset can be used to study data-to-text generation. The dataset is in sports domain. It pairs statistics of Major League Baseball (MLB) game with its summary. The summary is in the form of a document containing an average of 540 tokens. Thus it is useful to study long document generation.
|
149 |
-
|
150 |
-
#### Add. License Info
|
151 |
-
|
152 |
-
<!-- info: What is the 'other' license of the dataset? -->
|
153 |
-
<!-- scope: periscope -->
|
154 |
-
Restricted to non-commercial research purposes.
|
155 |
-
|
156 |
-
#### Primary Task
|
157 |
-
|
158 |
-
<!-- info: What primary task does the dataset support? -->
|
159 |
-
<!-- scope: telescope -->
|
160 |
-
Data-to-Text
|
161 |
-
|
162 |
-
#### Communicative Goal
|
163 |
-
|
164 |
-
<!-- quick -->
|
165 |
-
<!-- info: Provide a short description of the communicative goal of a model trained for this task on this dataset. -->
|
166 |
-
<!-- scope: periscope -->
|
167 |
-
Produce a summary of MLB game from its statistics.
|
168 |
-
|
169 |
-
|
170 |
-
### Credit
|
171 |
-
|
172 |
-
#### Curation Organization Type(s)
|
173 |
-
|
174 |
-
<!-- info: In what kind of organization did the dataset curation happen? -->
|
175 |
-
<!-- scope: telescope -->
|
176 |
-
`academic`
|
177 |
-
|
178 |
-
#### Curation Organization(s)
|
179 |
-
|
180 |
-
<!-- info: Name the organization(s). -->
|
181 |
-
<!-- scope: periscope -->
|
182 |
-
University of Edinburgh
|
183 |
-
|
184 |
-
#### Dataset Creators
|
185 |
-
|
186 |
-
<!-- info: Who created the original dataset? List the people involved in collecting the dataset and their affiliation(s). -->
|
187 |
-
<!-- scope: microscope -->
|
188 |
-
Ratish Puduppully, Li Dong, Mirella Lapata
|
189 |
-
|
190 |
-
|
191 |
-
### Dataset Structure
|
192 |
-
|
193 |
-
#### Data Fields
|
194 |
-
|
195 |
-
<!-- info: List and describe the fields present in the dataset. -->
|
196 |
-
<!-- scope: telescope -->
|
197 |
-
```
|
198 |
-
features = datasets.Features(
|
199 |
-
{
|
200 |
-
"home_name": datasets.Value("string"),
|
201 |
-
"box_score": [
|
202 |
-
{
|
203 |
-
"p_l": datasets.Value("string"),
|
204 |
-
"last_name": datasets.Value("string"),
|
205 |
-
"p_h": datasets.Value("string"),
|
206 |
-
"sac": datasets.Value("string"),
|
207 |
-
"p_bb": datasets.Value("string"),
|
208 |
-
"pos": datasets.Value("string"),
|
209 |
-
"ao": datasets.Value("string"),
|
210 |
-
"p_bf": datasets.Value("string"),
|
211 |
-
"cs": datasets.Value("string"),
|
212 |
-
"hbp": datasets.Value("string"),
|
213 |
-
"ab": datasets.Value("string"),
|
214 |
-
"full_name": datasets.Value("string"),
|
215 |
-
"p_w": datasets.Value("string"),
|
216 |
-
"go": datasets.Value("string"),
|
217 |
-
"fldg": datasets.Value("string"),
|
218 |
-
"p_bs": datasets.Value("string"),
|
219 |
-
"avg": datasets.Value("string"),
|
220 |
-
"p_r": datasets.Value("string"),
|
221 |
-
"p_s": datasets.Value("string"),
|
222 |
-
"lob": datasets.Value("string"),
|
223 |
-
"first_name": datasets.Value("string"),
|
224 |
-
"p_sv": datasets.Value("string"),
|
225 |
-
"p_so": datasets.Value("string"),
|
226 |
-
"p_save": datasets.Value("string"),
|
227 |
-
"p_hr": datasets.Value("string"),
|
228 |
-
"po": datasets.Value("string"),
|
229 |
-
"p_ip1": datasets.Value("string"),
|
230 |
-
"p_ip2": datasets.Value("string"),
|
231 |
-
"bb": datasets.Value("string"),
|
232 |
-
"ops": datasets.Value("string"),
|
233 |
-
"p_hld": datasets.Value("string"),
|
234 |
-
"bo": datasets.Value("string"),
|
235 |
-
"p_loss": datasets.Value("string"),
|
236 |
-
"e": datasets.Value("string"),
|
237 |
-
"p_game_score": datasets.Value("string"),
|
238 |
-
"p_win": datasets.Value("string"),
|
239 |
-
"a": datasets.Value("string"),
|
240 |
-
"p_era": datasets.Value("string"),
|
241 |
-
"d": datasets.Value("string"),
|
242 |
-
"p_out": datasets.Value("string"),
|
243 |
-
"h": datasets.Value("string"),
|
244 |
-
"p_er": datasets.Value("string"),
|
245 |
-
"p_np": datasets.Value("string"),
|
246 |
-
"hr": datasets.Value("string"),
|
247 |
-
"r": datasets.Value("string"),
|
248 |
-
"so": datasets.Value("string"),
|
249 |
-
"t": datasets.Value("string"),
|
250 |
-
"rbi": datasets.Value("string"),
|
251 |
-
"team": datasets.Value("string"),
|
252 |
-
"sb": datasets.Value("string"),
|
253 |
-
"slg": datasets.Value("string"),
|
254 |
-
"sf": datasets.Value("string"),
|
255 |
-
"obp": datasets.Value("string"),
|
256 |
-
}
|
257 |
-
],
|
258 |
-
"home_city": datasets.Value("string"),
|
259 |
-
"vis_name": datasets.Value("string"),
|
260 |
-
"play_by_play": [{
|
261 |
-
"top": [{
|
262 |
-
"runs": datasets.Value("string"),
|
263 |
-
"scorers": [
|
264 |
-
datasets.Value("string")
|
265 |
-
],
|
266 |
-
"pitcher": datasets.Value("string"),
|
267 |
-
"o": datasets.Value("string"),
|
268 |
-
"b": datasets.Value("string"),
|
269 |
-
"s": datasets.Value("string"),
|
270 |
-
"batter": datasets.Value("string"),
|
271 |
-
"b1": [
|
272 |
-
datasets.Value("string")
|
273 |
-
],
|
274 |
-
"b2": [
|
275 |
-
datasets.Value("string")
|
276 |
-
],
|
277 |
-
"b3": [
|
278 |
-
datasets.Value("string")
|
279 |
-
],
|
280 |
-
"event": datasets.Value("string"),
|
281 |
-
"event2": datasets.Value("string"),
|
282 |
-
"home_team_runs": datasets.Value("string"),
|
283 |
-
"away_team_runs": datasets.Value("string"),
|
284 |
-
"rbi": datasets.Value("string"),
|
285 |
-
"error_runs": datasets.Value("string"),
|
286 |
-
"fielder_error": datasets.Value("string")
|
287 |
-
}
|
288 |
-
],
|
289 |
-
"bottom": [{
|
290 |
-
"runs": datasets.Value("string"),
|
291 |
-
"scorers": [
|
292 |
-
datasets.Value("string")
|
293 |
-
],
|
294 |
-
"pitcher": datasets.Value("string"),
|
295 |
-
"o": datasets.Value("string"),
|
296 |
-
"b": datasets.Value("string"),
|
297 |
-
"s": datasets.Value("string"),
|
298 |
-
"batter": datasets.Value("string"),
|
299 |
-
"b1": [
|
300 |
-
datasets.Value("string")
|
301 |
-
],
|
302 |
-
"b2": [
|
303 |
-
datasets.Value("string")
|
304 |
-
],
|
305 |
-
"b3": [
|
306 |
-
datasets.Value("string")
|
307 |
-
],
|
308 |
-
"event": datasets.Value("string"),
|
309 |
-
"event2": datasets.Value("string"),
|
310 |
-
"home_team_runs": datasets.Value("string"),
|
311 |
-
"away_team_runs": datasets.Value("string"),
|
312 |
-
"rbi": datasets.Value("string"),
|
313 |
-
"error_runs": datasets.Value("string"),
|
314 |
-
"fielder_error": datasets.Value("string")
|
315 |
-
}
|
316 |
-
],
|
317 |
-
"inning": datasets.Value("string")
|
318 |
-
}
|
319 |
-
],
|
320 |
-
"vis_line": {
|
321 |
-
"innings": [{
|
322 |
-
"inn": datasets.Value("string"),
|
323 |
-
"runs": datasets.Value("string")
|
324 |
-
}
|
325 |
-
],
|
326 |
-
"result": datasets.Value("string"),
|
327 |
-
"team_runs": datasets.Value("string"),
|
328 |
-
"team_hits": datasets.Value("string"),
|
329 |
-
"team_errors": datasets.Value("string"),
|
330 |
-
"team_name": datasets.Value("string"),
|
331 |
-
"team_city": datasets.Value("string")
|
332 |
-
},
|
333 |
-
"home_line": {
|
334 |
-
"innings": [{
|
335 |
-
"inn": datasets.Value("string"),
|
336 |
-
"runs": datasets.Value("string")
|
337 |
-
}
|
338 |
-
],
|
339 |
-
"result": datasets.Value("string"),
|
340 |
-
"team_runs": datasets.Value("string"),
|
341 |
-
"team_hits": datasets.Value("string"),
|
342 |
-
"team_errors": datasets.Value("string"),
|
343 |
-
"team_name": datasets.Value("string"),
|
344 |
-
"team_city": datasets.Value("string")
|
345 |
-
},
|
346 |
-
"vis_city": datasets.Value("string"),
|
347 |
-
"day": datasets.Value("string"),
|
348 |
-
"summary": [
|
349 |
-
datasets.Value("string"),
|
350 |
-
],
|
351 |
-
"gem_id": datasets.Value("string")
|
352 |
-
}
|
353 |
-
```
|
354 |
-
|
355 |
-
#### Reason for Structure
|
356 |
-
|
357 |
-
<!-- info: How was the dataset structure determined? -->
|
358 |
-
<!-- scope: microscope -->
|
359 |
-
The high level structure contains the following attributes: home_name, vis_name, home_city, vis_city, summary, summary_eval, day, gem_id, box_score, play_by_play, home_line, vis_line.
|
360 |
-
The attributes home_name, vis_name, home_city, vis_city and day are string values.
|
361 |
-
The attribute "summary" contains the summary in the form of a list of tokens.
|
362 |
-
The attribute "summary_eval" contains the summary in the form of a string of tokens. The difference from "summary" field is that "summary_eval" doesn't contain "*NEWPARAGRAPH*" delimiters to separate the paragraphs. "summary_eval" field should be used to evaluate model outputs. "summary" field may be used during the training process.
|
363 |
-
box_score contains the box score statistics of the players in the game. It is in the form of a list (of average size 90), with each element describing the statistics of a player. The box score statistics contain 53 attributes.
|
364 |
-
The description of the attributes is given below. The descriptions of most of the attributes is obtained from [mlb.com](https://www.mlb.com/glossary/standard-stats).
|
365 |
-
|
366 |
-
- r : Runs scored by a player in the game.
|
367 |
-
- rbi Runs Batted In (RBI): action of a batter results in a run scored by other players in the team.
|
368 |
-
- pos Position of the player.
|
369 |
-
- avg Batting Average. It is an indicator of the hits in the players' career.
|
370 |
-
- bb A walk occurs when a pitcher throws four pitches out of the strike zone, none of which are swung at by the hitter.
|
371 |
-
- hr Batter hits the ball in the air over the outfield fence.
|
372 |
-
- p_r Runs given by a pitcher in the game.
|
373 |
-
- p_bb Walks allowed by pitcher in a game.
|
374 |
-
- p_h Hits allowed by pitcher in a game.
|
375 |
-
- p_hr Home runs allowed by pitcher in a game.
|
376 |
-
- p_er Earned Run (ER): An earned run is any run that scores against a pitcher.
|
377 |
-
- p_era Earned Run Average (ERA): Earned run average represents the number of earned runs a pitcher allows per nine innings.
|
378 |
-
- p_np Number of Pitches: A pitcher's total number of pitches is determined by all the pitches he throws in game.
|
379 |
-
- p_ip1 Innings Pitched (IP1): Innings pitched measures the number of innings a pitcher remains in a game. Because there are three outs in an inning, each out recorded represents one-third of an inning pitched.
|
380 |
-
- p_ip2 Innings Pitched (IP2): Innings pitched measures the number of innings a pitcher remains in a game. Because there are three outs in an inning, each out recorded represents one-third of an inning pitched.
|
381 |
-
- p_w A pitcher receives a win when he is the pitcher of record when his team takes the lead for good.
|
382 |
-
- p_l A pitcher receives a loss when a run that is charged to him proves to be the go-ahead run in the game, giving the opposing team a lead it never gives up.
|
383 |
-
- p_so A strikeout occurs when a pitcher throws any combination of three swinging or looking strikes to a hitter.
|
384 |
-
- p_save Save: A save is awarded to the relief pitcher who finishes a game for the winning team. A pitcher cannot receive a save and a win in the same game.
|
385 |
-
- p_sv Saves: The count of saves recorded by a pitcher in his career.
|
386 |
-
- sac A sacrifice fly occurs when a batter hits a fly-ball out to the outfield or foul territory that allows a runner to score.
|
387 |
-
- p_bf Batters faced is simply a count of the number of total plate appearances against a certain pitcher or team. In a perfect game -- with 27 outs -- a pitcher will record 27 batters faced.
|
388 |
-
- cs A caught stealing occurs when a runner attempts to steal but is tagged out before reaching second base, third base or home plate.
|
389 |
-
- hbp A hit-by-pitch occurs when a batter is struck by a pitched ball without swinging at it. He is awarded first base as a result.
|
390 |
-
- ab An official at-bat comes when a batter reaches base via a fielder's choice, hit or an error (not including catcher's interference) or when a batter is put out on a non-sacrifice.
|
391 |
-
- p_bs A blown save occurs when a relief pitcher enters a game in a save situation, but allows the tying run to score.
|
392 |
-
- p_s The count of strikes thrown by a pitcher
|
393 |
-
- lob Left on base can be viewed as both an individual statistic or as a team statistic. In an individual batter's case, it refers to how many men remain on base after that batter makes an out at the plate, as the batter has failed to do his job to score those runners -- or at least put himself in a position to score. In a team's case or in an individual pitcher's case, it refers to the number of men who remain on base at the end of an inning.
|
394 |
-
- po A fielder is credited with a putout when he is the fielder who physically records the act of completing an out -- whether it be by stepping on the base for a forceout, tagging a runner, catching a batted ball, or catching a third strike
|
395 |
-
- ops OPS adds on-base percentage and slugging percentage to get one number that unites the two. It's meant to combine how well a hitter can reach base, with how well he can hit for average and for power.
|
396 |
-
- p_hld A hold occurs when a relief pitcher enters the game in a save situation and maintains his team's lead for the next relief pitcher, while recording at least one out.
|
397 |
-
- p_loss True/False- Indicates losing pitcher
|
398 |
-
- e A fielder is given an error if, in the judgment of the official scorer, he fails to convert an out on a play that an average fielder should have made.
|
399 |
-
- p_win True/False- Indicates winning pitcher
|
400 |
-
- a An assist is awarded to a fielder who touches the ball before a putout is recorded by another fielder.
|
401 |
-
- h A hit occurs when a batter strikes the baseball into fair territory and reaches base without doing so via an error or a fielder's choice.
|
402 |
-
- so A strikeout of a batter
|
403 |
-
- team Team of the player
|
404 |
-
- sb A stolen base occurs when a baserunner advances by taking a base to which he isn't entitled.
|
405 |
-
- slg Slugging percentage represents the total number of bases a player records per at-bat. Unlike on-base percentage, slugging percentage deals only with hits and does not include walks and hit-by-pitches in its equation.
|
406 |
-
- sf A sacrifice fly occurs when a batter hits a fly-ball out to the outfield or foul territory that allows a runner to score.
|
407 |
-
- obp OBP refers to how frequently a batter reaches base per plate appearance. Times on base include hits, walks and hit-by-pitches, but do not include errors, times reached on a fielder's choice or a dropped third strike.
|
408 |
-
|
409 |
-
The description of attributes in play-by-play is below:
|
410 |
-
|
411 |
-
- batter Batter in the play.
|
412 |
-
- pitcher Pitcher in play.
|
413 |
-
- b1 Player/s at first base position.
|
414 |
-
- b2 Player/s at second base position.
|
415 |
-
- b3 Player/s at third base position.
|
416 |
-
- scorers Player/s scored in the play.
|
417 |
-
- fielder_error Player committed field error.
|
418 |
-
- event Event of the play such as single, double, home run etc.
|
419 |
-
- event2 Second event of the play such as wild pitch, error etc.
|
420 |
-
- inning Inning of the play.
|
421 |
-
- top/ bottom If home team is batting it is bottom and if away team is batting it is top.
|
422 |
-
- o Count of outs
|
423 |
-
- b Count of balls
|
424 |
-
- s Count of strikes
|
425 |
-
- r Count of runs
|
426 |
-
- rbi Count of runs batted in (rbi)
|
427 |
-
- error_runs Runs due to error
|
428 |
-
- home_team_runs Score of home team
|
429 |
-
- vis_team_runs Score of visiting team
|
430 |
-
|
431 |
-
`home_line` and `vis_line` contain string value pairs for `team_name`, `team_city`, `team_runs`, `team_hits`, `team_error`, `result`, and a list of runs scored in each inning.
|
432 |
-
|
433 |
-
#### Data Splits
|
434 |
-
|
435 |
-
<!-- info: Describe and name the splits in the dataset if there are more than one. -->
|
436 |
-
<!-- scope: periscope -->
|
437 |
-
There are three splits in the dataset: train, validation and test
|
438 |
-
|
439 |
-
#### Splitting Criteria
|
440 |
-
|
441 |
-
<!-- info: Describe any criteria for splitting the data, if used. If there are differences between the splits (e.g., if the training annotations are machine-generated and the dev and test ones are created by humans, or if different numbers of annotators contributed to each example), describe them here. -->
|
442 |
-
<!-- scope: microscope -->
|
443 |
-
The splits are random.
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
## Dataset in GEM
|
448 |
-
|
449 |
-
### Rationale for Inclusion in GEM
|
450 |
-
|
451 |
-
#### Why is the Dataset in GEM?
|
452 |
-
|
453 |
-
<!-- info: What does this dataset contribute toward better generation evaluation and why is it part of GEM? -->
|
454 |
-
<!-- scope: microscope -->
|
455 |
-
This dataset can verify if models are capable of long document generation. The challenges in long document generation conditioned on input tables include ensuring coherent output, staying faithful to the input, ensuring fluent output and avoiding repetition of text. Such aspects can be verified on models trained on this dataset
|
456 |
-
|
457 |
-
#### Similar Datasets
|
458 |
-
|
459 |
-
<!-- info: Do other datasets for the high level task exist? -->
|
460 |
-
<!-- scope: telescope -->
|
461 |
-
yes
|
462 |
-
|
463 |
-
#### Unique Language Coverage
|
464 |
-
|
465 |
-
<!-- info: Does this dataset cover other languages than other datasets for the same task? -->
|
466 |
-
<!-- scope: periscope -->
|
467 |
-
no
|
468 |
-
|
469 |
-
#### Difference from other GEM datasets
|
470 |
-
|
471 |
-
<!-- info: What else sets this dataset apart from other similar datasets in GEM? -->
|
472 |
-
<!-- scope: microscope -->
|
473 |
-
Compared to the existing RotoWire (Wiseman et al. 2017) dataset, MLB summaries are longer (approximately by 50%) and the input records are richer and more structured (with the addition of play-by-play). Moreover, the MLB dataset is five times larger in terms of data size (i.e., pairs of tables and game summaries).
|
474 |
-
|
475 |
-
#### Ability that the Dataset measures
|
476 |
-
|
477 |
-
<!-- info: What aspect of model ability can be measured with this dataset? -->
|
478 |
-
<!-- scope: periscope -->
|
479 |
-
Long document generation, coherent ordering of information, faithfulness to the input statistics, fluency in generation and avoiding repetition of text.
|
480 |
-
|
481 |
-
|
482 |
-
### GEM-Specific Curation
|
483 |
-
|
484 |
-
#### Modificatied for GEM?
|
485 |
-
|
486 |
-
<!-- info: Has the GEM version of the dataset been modified in any way (data, processing, splits) from the original curated data? -->
|
487 |
-
<!-- scope: telescope -->
|
488 |
-
yes
|
489 |
-
|
490 |
-
#### GEM Modifications
|
491 |
-
|
492 |
-
<!-- info: What changes have been made to he original dataset? -->
|
493 |
-
<!-- scope: periscope -->
|
494 |
-
`data points removed`
|
495 |
-
|
496 |
-
#### Modification Details
|
497 |
-
|
498 |
-
<!-- info: For each of these changes, described them in more details and provided the intended purpose of the modification -->
|
499 |
-
<!-- scope: microscope -->
|
500 |
-
Some examples have been removed from training dataset which satisfied the below criteria:
|
501 |
-
1. The examples in training dataset which overlapped with validation/test.
|
502 |
-
2. Some examples which described washed out games.
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
#### Additional Splits?
|
507 |
-
|
508 |
-
<!-- info: Does GEM provide additional splits to the dataset? -->
|
509 |
-
<!-- scope: telescope -->
|
510 |
-
no
|
511 |
-
|
512 |
-
|
513 |
-
### Getting Started with the Task
|
514 |
-
|
515 |
-
#### Pointers to Resources
|
516 |
-
|
517 |
-
<!-- info: Getting started with in-depth research on the task. Add relevant pointers to resources that researchers can consult when they want to get started digging deeper into the task. -->
|
518 |
-
<!-- scope: microscope -->
|
519 |
-
The [research paper](https://aclanthology.org/P19-1195) is a good resource
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
## Previous Results
|
524 |
-
|
525 |
-
### Previous Results
|
526 |
-
|
527 |
-
#### Measured Model Abilities
|
528 |
-
|
529 |
-
<!-- info: What aspect of model ability can be measured with this dataset? -->
|
530 |
-
<!-- scope: telescope -->
|
531 |
-
Automatic evaluation measure can evaluate the factuality, content selection, content ordering and the fluency of the model output. The factuality, content selection and content ordering is measured using an Information Extraction based evaluation approach introduced by Wiseman et al (2017). The fluency is measured using BLEU.
|
532 |
-
|
533 |
-
#### Metrics
|
534 |
-
|
535 |
-
<!-- info: What metrics are typically used for this task? -->
|
536 |
-
<!-- scope: periscope -->
|
537 |
-
`Other: Other Metrics`
|
538 |
-
|
539 |
-
#### Other Metrics
|
540 |
-
|
541 |
-
<!-- info: Definitions of other metrics -->
|
542 |
-
<!-- scope: periscope -->
|
543 |
-
Wiseman et al. (2017) define three metrics induced from the outputs of an Information Extraction model which is run on the model/human-written game summaries . Let ŷ be the gold summary and y the model output.
|
544 |
-
• Relation Generation (RG) measures the precision and count of relations extracted from y that also appear in records r.
|
545 |
-
• Content Selection (CS) measures the precision and recall of relations extracted from y that are also extracted from ŷ.
|
546 |
-
• Content Ordering (CO) measures the complement of the normalized Damerau-Levenshtein distance (Brill and Moore, 2000) between the sequences of relations extracted from y and ŷ
|
547 |
-
|
548 |
-
#### Proposed Evaluation
|
549 |
-
|
550 |
-
<!-- info: List and describe the purpose of the metrics and evaluation methodology (including human evaluation) that the dataset creators used when introducing this task. -->
|
551 |
-
<!-- scope: microscope -->
|
552 |
-
We have reused the automatic metrics based on Information Extraction evaluation introduced by Wiseman et al (2017). For human evaluation, we conducted studies to evaluate the factuality, coherence, grammaticality and conciseness.
|
553 |
-
|
554 |
-
#### Previous results available?
|
555 |
-
|
556 |
-
<!-- info: Are previous results available? -->
|
557 |
-
<!-- scope: telescope -->
|
558 |
-
yes
|
559 |
-
|
560 |
-
#### Relevant Previous Results
|
561 |
-
|
562 |
-
<!-- info: What are the most relevant previous results for this task/dataset? -->
|
563 |
-
<!-- scope: microscope -->
|
564 |
-
The most relevant previous results for dataset are in the TACL 2021 paper on [Data-to-text Generation with Macro Planning](https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00381/101876/Data-to-text-Generation-with-Macro-Planning)
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
## Dataset Curation
|
569 |
-
|
570 |
-
### Original Curation
|
571 |
-
|
572 |
-
#### Original Curation Rationale
|
573 |
-
|
574 |
-
<!-- info: Original curation rationale -->
|
575 |
-
<!-- scope: telescope -->
|
576 |
-
This dataset was curated to complement an existing data-to-text generation dataset (RotoWire by Wiseman et al. 2017) which focuses on long document generation. Compared to RotoWire , MLB summaries are longer (approximately by 50%) and the input records are richer and more structured (with the addition of play-by-play). Moreover, the MLB dataset is five times larger in terms of data size (i.e., pairs of tables and game summaries)
|
577 |
-
|
578 |
-
#### Communicative Goal
|
579 |
-
|
580 |
-
<!-- info: What was the communicative goal? -->
|
581 |
-
<!-- scope: periscope -->
|
582 |
-
The goal is to study automatic generation of long documents in a data-to-text setting. The generated summaries should exhibit coherent ordering of content, be faithful to the input statistics, be fluent and avoid repetition of text.
|
583 |
-
|
584 |
-
#### Sourced from Different Sources
|
585 |
-
|
586 |
-
<!-- info: Is the dataset aggregated from different data sources? -->
|
587 |
-
<!-- scope: telescope -->
|
588 |
-
no
|
589 |
-
|
590 |
-
|
591 |
-
### Language Data
|
592 |
-
|
593 |
-
#### How was Language Data Obtained?
|
594 |
-
|
595 |
-
<!-- info: How was the language data obtained? -->
|
596 |
-
<!-- scope: telescope -->
|
597 |
-
`Found`
|
598 |
-
|
599 |
-
#### Where was it found?
|
600 |
-
|
601 |
-
<!-- info: If found, where from? -->
|
602 |
-
<!-- scope: telescope -->
|
603 |
-
`Single website`
|
604 |
-
|
605 |
-
#### Language Producers
|
606 |
-
|
607 |
-
<!-- info: What further information do we have on the language producers? -->
|
608 |
-
<!-- scope: microscope -->
|
609 |
-
The game summaries are produced by professional writers.
|
610 |
-
|
611 |
-
#### Topics Covered
|
612 |
-
|
613 |
-
<!-- info: Does the language in the dataset focus on specific topics? How would you describe them? -->
|
614 |
-
<!-- scope: periscope -->
|
615 |
-
The language focuses on the sports domain.
|
616 |
-
|
617 |
-
#### Data Validation
|
618 |
-
|
619 |
-
<!-- info: Was the text validated by a different worker or a data curator? -->
|
620 |
-
<!-- scope: telescope -->
|
621 |
-
not validated
|
622 |
-
|
623 |
-
#### Data Preprocessing
|
624 |
-
|
625 |
-
<!-- info: How was the text data pre-processed? (Enter N/A if the text was not pre-processed) -->
|
626 |
-
<!-- scope: microscope -->
|
627 |
-
Game summaries were tokenized using NLTK (Bird et al., 2009) and hyphenated words were separated. Sentences containing quotes were removed as they included opinions and non-factual statements unrelated to the input tables. Sometimes MLB summaries contain a "Game notes" section with incidental information which was also removed.
|
628 |
-
|
629 |
-
#### Was Data Filtered?
|
630 |
-
|
631 |
-
<!-- info: Were text instances selected or filtered? -->
|
632 |
-
<!-- scope: telescope -->
|
633 |
-
not filtered
|
634 |
-
|
635 |
-
|
636 |
-
### Structured Annotations
|
637 |
-
|
638 |
-
#### Additional Annotations?
|
639 |
-
|
640 |
-
<!-- quick -->
|
641 |
-
<!-- info: Does the dataset have additional annotations for each instance? -->
|
642 |
-
<!-- scope: telescope -->
|
643 |
-
none
|
644 |
-
|
645 |
-
#### Annotation Service?
|
646 |
-
|
647 |
-
<!-- info: Was an annotation service used? -->
|
648 |
-
<!-- scope: telescope -->
|
649 |
-
no
|
650 |
-
|
651 |
-
|
652 |
-
### Consent
|
653 |
-
|
654 |
-
#### Any Consent Policy?
|
655 |
-
|
656 |
-
<!-- info: Was there a consent policy involved when gathering the data? -->
|
657 |
-
<!-- scope: telescope -->
|
658 |
-
no
|
659 |
-
|
660 |
-
#### Justification for Using the Data
|
661 |
-
|
662 |
-
<!-- info: If not, what is the justification for reusing the data? -->
|
663 |
-
<!-- scope: microscope -->
|
664 |
-
The copyright remains with the original data creators and the usage permission is restricted to non-commercial uses.
|
665 |
-
|
666 |
-
|
667 |
-
### Private Identifying Information (PII)
|
668 |
-
|
669 |
-
#### Contains PII?
|
670 |
-
|
671 |
-
<!-- quick -->
|
672 |
-
<!-- info: Does the source language data likely contain Personal Identifying Information about the data creators or subjects? -->
|
673 |
-
<!-- scope: telescope -->
|
674 |
-
yes/very likely
|
675 |
-
|
676 |
-
#### Categories of PII
|
677 |
-
|
678 |
-
<!-- info: What categories of PII are present or suspected in the data? -->
|
679 |
-
<!-- scope: periscope -->
|
680 |
-
`sensitive information`, `generic PII`
|
681 |
-
|
682 |
-
#### Any PII Identification?
|
683 |
-
|
684 |
-
<!-- info: Did the curators use any automatic/manual method to identify PII in the dataset? -->
|
685 |
-
<!-- scope: periscope -->
|
686 |
-
no identification
|
687 |
-
|
688 |
-
|
689 |
-
### Maintenance
|
690 |
-
|
691 |
-
#### Any Maintenance Plan?
|
692 |
-
|
693 |
-
<!-- info: Does the original dataset have a maintenance plan? -->
|
694 |
-
<!-- scope: telescope -->
|
695 |
-
no
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
## Broader Social Context
|
700 |
-
|
701 |
-
### Previous Work on the Social Impact of the Dataset
|
702 |
-
|
703 |
-
#### Usage of Models based on the Data
|
704 |
-
|
705 |
-
<!-- info: Are you aware of cases where models trained on the task featured in this dataset ore related tasks have been used in automated systems? -->
|
706 |
-
<!-- scope: telescope -->
|
707 |
-
no
|
708 |
-
|
709 |
-
|
710 |
-
### Impact on Under-Served Communities
|
711 |
-
|
712 |
-
#### Addresses needs of underserved Communities?
|
713 |
-
|
714 |
-
<!-- info: Does this dataset address the needs of communities that are traditionally underserved in language technology, and particularly language generation technology? Communities may be underserved for exemple because their language, language variety, or social or geographical context is underepresented in NLP and NLG resources (datasets and models). -->
|
715 |
-
<!-- scope: telescope -->
|
716 |
-
no
|
717 |
-
|
718 |
-
|
719 |
-
### Discussion of Biases
|
720 |
-
|
721 |
-
#### Any Documented Social Biases?
|
722 |
-
|
723 |
-
<!-- info: Are there documented social biases in the dataset? Biases in this context are variations in the ways members of different social categories are represented that can have harmful downstream consequences for members of the more disadvantaged group. -->
|
724 |
-
<!-- scope: telescope -->
|
725 |
-
unsure
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
## Considerations for Using the Data
|
730 |
-
|
731 |
-
### PII Risks and Liability
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
### Licenses
|
736 |
-
|
737 |
-
#### Copyright Restrictions on the Dataset
|
738 |
-
|
739 |
-
<!-- info: Based on your answers in the Intended Use part of the Data Overview Section, which of the following best describe the copyright and licensing status of the dataset? -->
|
740 |
-
<!-- scope: periscope -->
|
741 |
-
`research use only`
|
742 |
-
|
743 |
-
#### Copyright Restrictions on the Language Data
|
744 |
-
|
745 |
-
<!-- info: Based on your answers in the Language part of the Data Curation Section, which of the following best describe the copyright and licensing status of the underlying language data? -->
|
746 |
-
<!-- scope: periscope -->
|
747 |
-
`research use only`
|
748 |
-
|
749 |
-
|
750 |
-
### Known Technical Limitations
|
751 |
-
|
752 |
-
|
753 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create_mlb_data.py
DELETED
@@ -1,177 +0,0 @@
|
|
1 |
-
"""
|
2 |
-
Script creates mlb data for gem benchmark
|
3 |
-
"""
|
4 |
-
import argparse
|
5 |
-
import os
|
6 |
-
import json
|
7 |
-
import logging
|
8 |
-
logging.basicConfig(level=logging.INFO)
|
9 |
-
|
10 |
-
|
11 |
-
def sort_files_key(x):
|
12 |
-
if "train" in x:
|
13 |
-
file_index = int(x[5:7].strip(".")) # get the index of the train file
|
14 |
-
else:
|
15 |
-
file_index = -1 # valid and test
|
16 |
-
return file_index
|
17 |
-
|
18 |
-
|
19 |
-
def filter_summaries(summary_entry, seen_output, test_seen_output):
|
20 |
-
match_words = {"rain", "rains", "rained", "snow"}
|
21 |
-
filter = False
|
22 |
-
if len(summary_entry["summary"]) < 100:
|
23 |
-
filter = True
|
24 |
-
elif 100 < len(summary_entry["summary"]) < 300:
|
25 |
-
if len(match_words.intersection(set(summary_entry["summary"]))) > 0:
|
26 |
-
filter = True
|
27 |
-
elif "_".join(summary_entry["summary"][:50]) in seen_output: # retaining only one instance
|
28 |
-
filter = True
|
29 |
-
elif "_".join(summary_entry["summary"][:50]) in test_seen_output: # retaining only one instance
|
30 |
-
filter = True
|
31 |
-
return filter
|
32 |
-
|
33 |
-
|
34 |
-
def replace_Carmona(obj):
|
35 |
-
def decode_dict(a_dict):
|
36 |
-
for key, value in a_dict.items():
|
37 |
-
try:
|
38 |
-
if value == "Roberto Hernandez":
|
39 |
-
a_dict[key] = value.replace("Roberto Hernandez", "Fausto Carmona")
|
40 |
-
except AttributeError:
|
41 |
-
pass
|
42 |
-
return a_dict
|
43 |
-
return json.loads(json.dumps(obj), object_hook=decode_dict)
|
44 |
-
|
45 |
-
|
46 |
-
def process(input_folder, type, output_folder):
|
47 |
-
output_name_map = {"train": "train", "valid": "validation", "test": "test"}
|
48 |
-
output_jsonl = open(os.path.join(output_folder, output_name_map[type] + ".jsonl"), mode="w", encoding="utf-8")
|
49 |
-
file_list = os.listdir(input_folder)
|
50 |
-
sorted_file_list = sorted(file_list, key=sort_files_key)
|
51 |
-
seen_output = set()
|
52 |
-
test_seen_output = set()
|
53 |
-
if type == "train":
|
54 |
-
for filename in sorted_file_list:
|
55 |
-
if "valid" in filename or "test" in filename:
|
56 |
-
print("test filename", filename)
|
57 |
-
json_file = open(os.path.join(input_folder, filename), mode="r", encoding="utf-8")
|
58 |
-
data = json.load(json_file)
|
59 |
-
for entry_index, entry in enumerate(data):
|
60 |
-
test_seen_output.add("_".join(entry["summary"][:50]))
|
61 |
-
|
62 |
-
index = 1
|
63 |
-
for filename in sorted_file_list:
|
64 |
-
if type in filename:
|
65 |
-
print("filename", filename)
|
66 |
-
json_file = open(os.path.join(input_folder, filename), mode="r", encoding="utf-8")
|
67 |
-
data = json.load(json_file)
|
68 |
-
for entry_index, entry in enumerate(data):
|
69 |
-
logging.debug("instance %s", entry_index)
|
70 |
-
if type == "train":
|
71 |
-
if filter_summaries(entry, seen_output, test_seen_output):
|
72 |
-
continue
|
73 |
-
seen_output.add("_".join(entry["summary"][:50]))
|
74 |
-
|
75 |
-
summary = entry["summary"]
|
76 |
-
summ = " ".join(summary)
|
77 |
-
if "Fausto Carmona" in summ:
|
78 |
-
entry = replace_Carmona(entry)
|
79 |
-
gem_id = "GEM-mlb_data_to_text-"+ output_name_map[type] + "-" + str(index)
|
80 |
-
index += 1
|
81 |
-
|
82 |
-
updated_entry = {}
|
83 |
-
updated_entry["home_name"] = entry["home_name"]
|
84 |
-
updated_entry["vis_name"] = entry["vis_name"]
|
85 |
-
updated_entry["home_city"] = entry["home_city"]
|
86 |
-
updated_entry["vis_city"] = entry["vis_city"]
|
87 |
-
updated_entry["summary"] = entry["summary"]
|
88 |
-
updated_entry["summary_eval"] = " ".join(entry["summary"]).replace("*NEWPARAGRAPH* ", "")
|
89 |
-
updated_entry["day"] = entry["day"]
|
90 |
-
updated_entry["gem_id"] = gem_id
|
91 |
-
updated_entry["box_score"] = []
|
92 |
-
box_score_keys = entry["box_score"].keys()
|
93 |
-
construct_box_score(box_score_keys, entry["box_score"], updated_entry["box_score"])
|
94 |
-
assert len(updated_entry["box_score"]) == len(
|
95 |
-
entry["box_score"][list(box_score_keys)[-1]]) # checking sizes match
|
96 |
-
updated_entry["play_by_play"] = []
|
97 |
-
construct_play_by_play(entry["play_by_play"], updated_entry["play_by_play"])
|
98 |
-
updated_entry["vis_line"] = {}
|
99 |
-
updated_entry["home_line"] = {}
|
100 |
-
for attrib in ["team_runs", "result", "team_hits", "team_name", "team_errors", "team_city"]:
|
101 |
-
updated_entry["vis_line"][attrib] = entry["vis_line"][attrib]
|
102 |
-
updated_entry["home_line"][attrib] = entry["home_line"][attrib]
|
103 |
-
updated_entry["vis_line"]["innings"] = []
|
104 |
-
construct_inning_scores(entry["vis_line"]["innings"], updated_entry["vis_line"]["innings"])
|
105 |
-
updated_entry["home_line"]["innings"] = []
|
106 |
-
construct_inning_scores(entry["home_line"]["innings"], updated_entry["home_line"]["innings"])
|
107 |
-
json.dump(updated_entry, output_jsonl, ensure_ascii=False)
|
108 |
-
output_jsonl.write('\n')
|
109 |
-
if entry_index % 50 == 0:
|
110 |
-
print("entry_index", entry_index)
|
111 |
-
output_jsonl.close()
|
112 |
-
|
113 |
-
|
114 |
-
def construct_box_score(box_score_keys, box_score, box_score_list):
|
115 |
-
player_index = 0
|
116 |
-
while True:
|
117 |
-
box_score_object = {}
|
118 |
-
for _box_score_key in box_score_keys:
|
119 |
-
if str(player_index) not in box_score[_box_score_key]:
|
120 |
-
return
|
121 |
-
box_score_object[_box_score_key] = box_score[_box_score_key][str(player_index)]
|
122 |
-
box_score_list.append(box_score_object)
|
123 |
-
player_index += 1
|
124 |
-
|
125 |
-
|
126 |
-
def construct_play_by_play(play_by_play, play_by_play_list):
|
127 |
-
inning_index = 1
|
128 |
-
while True:
|
129 |
-
if str(inning_index) not in play_by_play:
|
130 |
-
return
|
131 |
-
play_by_play_object = {}
|
132 |
-
for side in ["top", "bottom"]:
|
133 |
-
if side in play_by_play[str(inning_index)]:
|
134 |
-
play_by_play_object[side] = []
|
135 |
-
for play in play_by_play[str(inning_index)][side]:
|
136 |
-
play_object = construct_play_object(play)
|
137 |
-
play_by_play_object[side].append(play_object)
|
138 |
-
|
139 |
-
play_by_play_object["inning"] = inning_index
|
140 |
-
play_by_play_list.append(play_by_play_object)
|
141 |
-
inning_index += 1
|
142 |
-
|
143 |
-
|
144 |
-
def construct_play_object(play):
|
145 |
-
play_object = {}
|
146 |
-
for attrib in ["runs", "pitcher", "o", "b", "s", "batter", "event", "event2", "home_team_runs", "away_team_runs",
|
147 |
-
"rbi", "error_runs", "fielder_error"]:
|
148 |
-
play_object[attrib] = "N/A"
|
149 |
-
if attrib in play:
|
150 |
-
play_object[attrib] = play[attrib]
|
151 |
-
for attrib in ["scorers", "b1", "b2", "b3"]:
|
152 |
-
play_object[attrib] = ["N/A"]
|
153 |
-
if attrib in play:
|
154 |
-
play_object[attrib] = play[attrib]
|
155 |
-
return play_object
|
156 |
-
|
157 |
-
|
158 |
-
def construct_inning_scores(innings, innings_list):
|
159 |
-
inning_index = 1
|
160 |
-
while True:
|
161 |
-
if "inn" + str(inning_index) not in innings:
|
162 |
-
return
|
163 |
-
innings_list.append({"inn": inning_index, "runs": innings["inn" + str(inning_index)]})
|
164 |
-
inning_index += 1
|
165 |
-
|
166 |
-
|
167 |
-
if __name__ == '__main__':
|
168 |
-
parser = argparse.ArgumentParser(description='Script for constructing the mlb dataset in GEM format')
|
169 |
-
parser.add_argument('-json_root', type=str,
|
170 |
-
help='path of json root; download from '
|
171 |
-
'https://drive.google.com/drive/folders/1G4iIE-02icAU2-5skvLlTEPWDQQj1ss4', default=None)
|
172 |
-
parser.add_argument('-output_folder', type=str,
|
173 |
-
help='path of output file', default=None)
|
174 |
-
parser.add_argument('-dataset_type', type=str,
|
175 |
-
help='type of dataset', default=None)
|
176 |
-
args = parser.parse_args()
|
177 |
-
process(args.json_root, args.dataset_type, args.output_folder)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.zip → default/mlb_data_to_text-test.parquet
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:96b17c0528cf56ba6f2e026fa2331e9f02e6299f2fe37f13ceb2234588343b0f
|
3 |
+
size 22442463
|
default/mlb_data_to_text-train-00000-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:20b3502eed6696dd6094366b3b0d33901eef5bb0a44920e0bc129271ca6db24e
|
3 |
+
size 77609307
|
default/mlb_data_to_text-train-00001-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9ddf787ac78737c99572895e7e8fc86688ba58ab504816689317ab81c47905c8
|
3 |
+
size 81229333
|
default/mlb_data_to_text-train-00002-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9844a128ceaaeef770759e87d66bc1ff3c918e904eee89a8a1e805c5b6d4f4f4
|
3 |
+
size 86021118
|
default/mlb_data_to_text-train-00003-of-00004.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:59e1e7185185b5dabfffebe46bf85a1fd142dae12dc29933e89cf657afa8712a
|
3 |
+
size 43626844
|
default/mlb_data_to_text-validation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3db33a981888c366b662542a9535010ab443cf5167dd623e0558102e9bb8d263
|
3 |
+
size 22450655
|
mlb_data_to_text.json
DELETED
@@ -1,174 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"overview": {
|
3 |
-
"where": {
|
4 |
-
"has-leaderboard": "no",
|
5 |
-
"leaderboard-url": "N/A",
|
6 |
-
"leaderboard-description": "N/A",
|
7 |
-
"website": "[Github](https://github.com/ratishsp/mlb-data-scripts)",
|
8 |
-
"data-url": "[Github](https://github.com/ratishsp/mlb-data-scripts)",
|
9 |
-
"paper-url": "[ACL Anthology](https://aclanthology.org/P19-1195)",
|
10 |
-
"paper-bibtext": "```\n@inproceedings{puduppully-etal-2019-data,\n title = \"Data-to-text Generation with Entity Modeling\",\n author = \"Puduppully, Ratish and\n Dong, Li and\n Lapata, Mirella\",\n booktitle = \"Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics\",\n month = jul,\n year = \"2019\",\n address = \"Florence, Italy\",\n publisher = \"Association for Computational Linguistics\",\n url = \"https://www.aclweb.org/anthology/P19-1195\",\n doi = \"10.18653/v1/P19-1195\",\n pages = \"2023--2035\",\n}\n```",
|
11 |
-
"contact-name": "Ratish Puduppully",
|
12 |
-
"contact-email": "[email protected]"
|
13 |
-
},
|
14 |
-
"languages": {
|
15 |
-
"is-multilingual": "no",
|
16 |
-
"license": "other: Other license",
|
17 |
-
"task-other": "N/A",
|
18 |
-
"language-names": [
|
19 |
-
"English"
|
20 |
-
],
|
21 |
-
"intended-use": "The dataset can be used to study data-to-text generation. The dataset is in sports domain. It pairs statistics of Major League Baseball (MLB) game with its summary. The summary is in the form of a document containing an average of 540 tokens. Thus it is useful to study long document generation.",
|
22 |
-
"license-other": "Restricted to non-commercial research purposes.",
|
23 |
-
"task": "Data-to-Text",
|
24 |
-
"communicative": "Produce a summary of MLB game from its statistics. "
|
25 |
-
},
|
26 |
-
"credit": {
|
27 |
-
"organization-type": [
|
28 |
-
"academic"
|
29 |
-
],
|
30 |
-
"organization-names": "University of Edinburgh",
|
31 |
-
"creators": "Ratish Puduppully, Li Dong, Mirella Lapata",
|
32 |
-
"funding": "",
|
33 |
-
"gem-added-by": ""
|
34 |
-
},
|
35 |
-
"structure": {
|
36 |
-
"data-fields": "```\n features = datasets.Features(\n {\n \"home_name\": datasets.Value(\"string\"),\n \"box_score\": [\n {\n \"p_l\": datasets.Value(\"string\"),\n \"last_name\": datasets.Value(\"string\"),\n \"p_h\": datasets.Value(\"string\"),\n \"sac\": datasets.Value(\"string\"),\n \"p_bb\": datasets.Value(\"string\"),\n \"pos\": datasets.Value(\"string\"),\n \"ao\": datasets.Value(\"string\"),\n \"p_bf\": datasets.Value(\"string\"),\n \"cs\": datasets.Value(\"string\"),\n \"hbp\": datasets.Value(\"string\"),\n \"ab\": datasets.Value(\"string\"),\n \"full_name\": datasets.Value(\"string\"),\n \"p_w\": datasets.Value(\"string\"),\n \"go\": datasets.Value(\"string\"),\n \"fldg\": datasets.Value(\"string\"),\n \"p_bs\": datasets.Value(\"string\"),\n \"avg\": datasets.Value(\"string\"),\n \"p_r\": datasets.Value(\"string\"),\n \"p_s\": datasets.Value(\"string\"),\n \"lob\": datasets.Value(\"string\"),\n \"first_name\": datasets.Value(\"string\"),\n \"p_sv\": datasets.Value(\"string\"),\n \"p_so\": datasets.Value(\"string\"),\n \"p_save\": datasets.Value(\"string\"),\n \"p_hr\": datasets.Value(\"string\"),\n \"po\": datasets.Value(\"string\"),\n \"p_ip1\": datasets.Value(\"string\"),\n \"p_ip2\": datasets.Value(\"string\"),\n \"bb\": datasets.Value(\"string\"),\n \"ops\": datasets.Value(\"string\"),\n \"p_hld\": datasets.Value(\"string\"),\n \"bo\": datasets.Value(\"string\"),\n \"p_loss\": datasets.Value(\"string\"),\n \"e\": datasets.Value(\"string\"),\n \"p_game_score\": datasets.Value(\"string\"),\n \"p_win\": datasets.Value(\"string\"),\n \"a\": datasets.Value(\"string\"),\n \"p_era\": datasets.Value(\"string\"),\n \"d\": datasets.Value(\"string\"),\n \"p_out\": datasets.Value(\"string\"),\n \"h\": datasets.Value(\"string\"),\n \"p_er\": datasets.Value(\"string\"),\n \"p_np\": datasets.Value(\"string\"),\n \"hr\": datasets.Value(\"string\"),\n \"r\": datasets.Value(\"string\"),\n \"so\": datasets.Value(\"string\"),\n \"t\": datasets.Value(\"string\"),\n \"rbi\": datasets.Value(\"string\"),\n \"team\": datasets.Value(\"string\"),\n \"sb\": datasets.Value(\"string\"),\n \"slg\": datasets.Value(\"string\"),\n \"sf\": datasets.Value(\"string\"),\n \"obp\": datasets.Value(\"string\"),\n }\n ],\n \"home_city\": datasets.Value(\"string\"),\n \"vis_name\": datasets.Value(\"string\"),\n \"play_by_play\": [{\n \"top\": [{\n \"runs\": datasets.Value(\"string\"),\n \"scorers\": [\n datasets.Value(\"string\")\n ],\n \"pitcher\": datasets.Value(\"string\"),\n \"o\": datasets.Value(\"string\"),\n \"b\": datasets.Value(\"string\"),\n \"s\": datasets.Value(\"string\"),\n \"batter\": datasets.Value(\"string\"),\n \"b1\": [\n datasets.Value(\"string\")\n ],\n \"b2\": [\n datasets.Value(\"string\")\n ],\n \"b3\": [\n datasets.Value(\"string\")\n ],\n \"event\": datasets.Value(\"string\"),\n \"event2\": datasets.Value(\"string\"),\n \"home_team_runs\": datasets.Value(\"string\"),\n \"away_team_runs\": datasets.Value(\"string\"),\n \"rbi\": datasets.Value(\"string\"),\n \"error_runs\": datasets.Value(\"string\"),\n \"fielder_error\": datasets.Value(\"string\")\n }\n ],\n \"bottom\": [{\n \"runs\": datasets.Value(\"string\"),\n \"scorers\": [\n datasets.Value(\"string\")\n ],\n \"pitcher\": datasets.Value(\"string\"),\n \"o\": datasets.Value(\"string\"),\n \"b\": datasets.Value(\"string\"),\n \"s\": datasets.Value(\"string\"),\n \"batter\": datasets.Value(\"string\"),\n \"b1\": [\n datasets.Value(\"string\")\n ],\n \"b2\": [\n datasets.Value(\"string\")\n ],\n \"b3\": [\n datasets.Value(\"string\")\n ],\n \"event\": datasets.Value(\"string\"),\n \"event2\": datasets.Value(\"string\"),\n \"home_team_runs\": datasets.Value(\"string\"),\n \"away_team_runs\": datasets.Value(\"string\"),\n \"rbi\": datasets.Value(\"string\"),\n \"error_runs\": datasets.Value(\"string\"),\n \"fielder_error\": datasets.Value(\"string\")\n }\n ],\n \"inning\": datasets.Value(\"string\")\n }\n ],\n \"vis_line\": {\n \"innings\": [{\n \"inn\": datasets.Value(\"string\"),\n \"runs\": datasets.Value(\"string\")\n }\n ],\n \"result\": datasets.Value(\"string\"),\n \"team_runs\": datasets.Value(\"string\"),\n \"team_hits\": datasets.Value(\"string\"),\n \"team_errors\": datasets.Value(\"string\"),\n \"team_name\": datasets.Value(\"string\"),\n \"team_city\": datasets.Value(\"string\")\n },\n \"home_line\": {\n \"innings\": [{\n \"inn\": datasets.Value(\"string\"),\n \"runs\": datasets.Value(\"string\")\n }\n ],\n \"result\": datasets.Value(\"string\"),\n \"team_runs\": datasets.Value(\"string\"),\n \"team_hits\": datasets.Value(\"string\"),\n \"team_errors\": datasets.Value(\"string\"),\n \"team_name\": datasets.Value(\"string\"),\n \"team_city\": datasets.Value(\"string\")\n },\n \"vis_city\": datasets.Value(\"string\"),\n \"day\": datasets.Value(\"string\"),\n \"summary\": [\n datasets.Value(\"string\"),\n ],\n \"gem_id\": datasets.Value(\"string\")\n }\n```",
|
37 |
-
"structure-description": "The high level structure contains the following attributes: home_name, vis_name, home_city, vis_city, summary, summary_eval, day, gem_id, box_score, play_by_play, home_line, vis_line.\nThe attributes home_name, vis_name, home_city, vis_city and day are string values.\nThe attribute \"summary\" contains the summary in the form of a list of tokens.\nThe attribute \"summary_eval\" contains the summary in the form of a string of tokens. The difference from \"summary\" field is that \"summary_eval\" doesn't contain \"*NEWPARAGRAPH*\" delimiters to separate the paragraphs. \"summary_eval\" field should be used to evaluate model outputs. \"summary\" field may be used during the training process.\nbox_score contains the box score statistics of the players in the game. It is in the form of a list (of average size 90), with each element describing the statistics of a player. The box score statistics contain 53 attributes. \nThe description of the attributes is given below. The descriptions of most of the attributes is obtained from [mlb.com](https://www.mlb.com/glossary/standard-stats). \n\n- r : Runs scored by a player in the game. \n- rbi Runs Batted In (RBI): action of a batter results in a run scored by other players in the team. \n- pos Position of the player. \n- avg Batting Average. It is an indicator of the hits in the players' career. \n- bb A walk occurs when a pitcher throws four pitches out of the strike zone, none of which are swung at by the hitter. \n- hr Batter hits the ball in the air over the outfield fence. \n- p_r Runs given by a pitcher in the game. \n- p_bb Walks allowed by pitcher in a game. \n- p_h Hits allowed by pitcher in a game. \n- p_hr Home runs allowed by pitcher in a game. \n- p_er Earned Run (ER): An earned run is any run that scores against a pitcher. \n- p_era Earned Run Average (ERA): Earned run average represents the number of earned runs a pitcher allows per nine innings. \n- p_np Number of Pitches: A pitcher's total number of pitches is determined by all the pitches he throws in game. \n- p_ip1 Innings Pitched (IP1): Innings pitched measures the number of innings a pitcher remains in a game. Because there are three outs in an inning, each out recorded represents one-third of an inning pitched. \n- p_ip2 Innings Pitched (IP2): Innings pitched measures the number of innings a pitcher remains in a game. Because there are three outs in an inning, each out recorded represents one-third of an inning pitched. \n- p_w A pitcher receives a win when he is the pitcher of record when his team takes the lead for good. \n- p_l A pitcher receives a loss when a run that is charged to him proves to be the go-ahead run in the game, giving the opposing team a lead it never gives up. \n- p_so A strikeout occurs when a pitcher throws any combination of three swinging or looking strikes to a hitter. \n- p_save Save: A save is awarded to the relief pitcher who finishes a game for the winning team. A pitcher cannot receive a save and a win in the same game. \n- p_sv Saves: The count of saves recorded by a pitcher in his career. \n- sac A sacrifice fly occurs when a batter hits a fly-ball out to the outfield or foul territory that allows a runner to score. \n- p_bf Batters faced is simply a count of the number of total plate appearances against a certain pitcher or team. In a perfect game -- with 27 outs -- a pitcher will record 27 batters faced. \n- cs A caught stealing occurs when a runner attempts to steal but is tagged out before reaching second base, third base or home plate. \n- hbp A hit-by-pitch occurs when a batter is struck by a pitched ball without swinging at it. He is awarded first base as a result. \n- ab An official at-bat comes when a batter reaches base via a fielder's choice, hit or an error (not including catcher's interference) or when a batter is put out on a non-sacrifice. \n- p_bs A blown save occurs when a relief pitcher enters a game in a save situation, but allows the tying run to score. \n- p_s The count of strikes thrown by a pitcher \n- lob Left on base can be viewed as both an individual statistic or as a team statistic. In an individual batter's case, it refers to how many men remain on base after that batter makes an out at the plate, as the batter has failed to do his job to score those runners -- or at least put himself in a position to score. In a team's case or in an individual pitcher's case, it refers to the number of men who remain on base at the end of an inning. \n- po A fielder is credited with a putout when he is the fielder who physically records the act of completing an out -- whether it be by stepping on the base for a forceout, tagging a runner, catching a batted ball, or catching a third strike \n- ops OPS adds on-base percentage and slugging percentage to get one number that unites the two. It's meant to combine how well a hitter can reach base, with how well he can hit for average and for power. \n- p_hld A hold occurs when a relief pitcher enters the game in a save situation and maintains his team's lead for the next relief pitcher, while recording at least one out. \n- p_loss True/False- Indicates losing pitcher \n- e A fielder is given an error if, in the judgment of the official scorer, he fails to convert an out on a play that an average fielder should have made. \n- p_win True/False- Indicates winning pitcher \n- a An assist is awarded to a fielder who touches the ball before a putout is recorded by another fielder. \n- h A hit occurs when a batter strikes the baseball into fair territory and reaches base without doing so via an error or a fielder's choice. \n- so A strikeout of a batter \n- team Team of the player \n- sb A stolen base occurs when a baserunner advances by taking a base to which he isn't entitled. \n- slg Slugging percentage represents the total number of bases a player records per at-bat. Unlike on-base percentage, slugging percentage deals only with hits and does not include walks and hit-by-pitches in its equation. \n- sf A sacrifice fly occurs when a batter hits a fly-ball out to the outfield or foul territory that allows a runner to score. \n- obp OBP refers to how frequently a batter reaches base per plate appearance. Times on base include hits, walks and hit-by-pitches, but do not include errors, times reached on a fielder's choice or a dropped third strike. \n\nThe description of attributes in play-by-play is below:\n\n- batter Batter in the play. \n- pitcher Pitcher in play. \n- b1 Player/s at first base position. \n- b2 Player/s at second base position. \n- b3 Player/s at third base position. \n- scorers Player/s scored in the play. \n- fielder_error Player committed field error. \n- event Event of the play such as single, double, home run etc. \n- event2 Second event of the play such as wild pitch, error etc. \n- inning Inning of the play. \n- top/ bottom If home team is batting it is bottom and if away team is batting it is top. \n- o Count of outs \n- b Count of balls \n- s Count of strikes \n- r Count of runs \n- rbi Count of runs batted in (rbi) \n- error_runs Runs due to error \n- home_team_runs Score of home team \n- vis_team_runs Score of visiting team \n\n`home_line` and `vis_line` contain string value pairs for `team_name`, `team_city`, `team_runs`, `team_hits`, `team_error`, `result`, and a list of runs scored in each inning.",
|
38 |
-
"structure-splits": "There are three splits in the dataset: train, validation and test",
|
39 |
-
"structure-splits-criteria": "The splits are random."
|
40 |
-
},
|
41 |
-
"what": {
|
42 |
-
"dataset": "The MLB dataset is an English sport-related data-to-text dataset in the baseball domain. The input is a large table with results of a game and the output is a description of the game."
|
43 |
-
}
|
44 |
-
},
|
45 |
-
"curation": {
|
46 |
-
"original": {
|
47 |
-
"is-aggregated": "no",
|
48 |
-
"aggregated-sources": "N/A",
|
49 |
-
"rationale": "This dataset was curated to complement an existing data-to-text generation dataset (RotoWire by Wiseman et al. 2017) which focuses on long document generation. Compared to RotoWire , MLB summaries are longer (approximately by 50%) and the input records are richer and more structured (with the addition of play-by-play). Moreover, the MLB dataset is five times larger in terms of data size (i.e., pairs of tables and game summaries)",
|
50 |
-
"communicative": "The goal is to study automatic generation of long documents in a data-to-text setting. The generated summaries should exhibit coherent ordering of content, be faithful to the input statistics, be fluent and avoid repetition of text."
|
51 |
-
},
|
52 |
-
"language": {
|
53 |
-
"found": [
|
54 |
-
"Single website"
|
55 |
-
],
|
56 |
-
"crowdsourced": [],
|
57 |
-
"created": "N/A",
|
58 |
-
"machine-generated": "N/A",
|
59 |
-
"validated": "not validated",
|
60 |
-
"is-filtered": "not filtered",
|
61 |
-
"filtered-criteria": "N/A",
|
62 |
-
"obtained": [
|
63 |
-
"Found"
|
64 |
-
],
|
65 |
-
"producers-description": "The game summaries are produced by professional writers.",
|
66 |
-
"topics": "The language focuses on the sports domain.",
|
67 |
-
"pre-processed": "Game summaries were tokenized using NLTK (Bird et al., 2009) and hyphenated words were separated. Sentences containing quotes were removed as they included opinions and non-factual statements unrelated to the input tables. Sometimes MLB summaries contain a \"Game notes\" section with incidental information which was also removed."
|
68 |
-
},
|
69 |
-
"annotations": {
|
70 |
-
"origin": "none",
|
71 |
-
"rater-number": "N/A",
|
72 |
-
"rater-qualifications": "N/A",
|
73 |
-
"rater-training-num": "N/A",
|
74 |
-
"rater-test-num": "N/A",
|
75 |
-
"rater-annotation-service-bool": "no",
|
76 |
-
"rater-annotation-service": [],
|
77 |
-
"values": "N/A",
|
78 |
-
"quality-control": [],
|
79 |
-
"quality-control-details": "N/A"
|
80 |
-
},
|
81 |
-
"consent": {
|
82 |
-
"has-consent": "no",
|
83 |
-
"consent-policy": "N/A",
|
84 |
-
"consent-other": "N/A",
|
85 |
-
"no-consent-justification": "The copyright remains with the original data creators and the usage permission is restricted to non-commercial uses."
|
86 |
-
},
|
87 |
-
"pii": {
|
88 |
-
"has-pii": "yes/very likely",
|
89 |
-
"no-pii-justification": "N/A",
|
90 |
-
"is-pii-identified": "no identification",
|
91 |
-
"pii-identified-method": "N/A",
|
92 |
-
"is-pii-replaced": "N/A",
|
93 |
-
"pii-replaced-method": "N/A",
|
94 |
-
"pii-categories": [
|
95 |
-
"sensitive information",
|
96 |
-
"generic PII"
|
97 |
-
]
|
98 |
-
},
|
99 |
-
"maintenance": {
|
100 |
-
"has-maintenance": "no",
|
101 |
-
"description": "N/A",
|
102 |
-
"contact": "N/A",
|
103 |
-
"contestation-mechanism": "N/A",
|
104 |
-
"contestation-link": "N/A",
|
105 |
-
"contestation-description": "N/A"
|
106 |
-
}
|
107 |
-
},
|
108 |
-
"gem": {
|
109 |
-
"rationale": {
|
110 |
-
"sole-task-dataset": "yes",
|
111 |
-
"distinction-description": "Compared to the existing RotoWire (Wiseman et al. 2017) dataset, MLB summaries are longer (approximately by 50%) and the input records are richer and more structured (with the addition of play-by-play). Moreover, the MLB dataset is five times larger in terms of data size (i.e., pairs of tables and game summaries).",
|
112 |
-
"contribution": "This dataset can verify if models are capable of long document generation. The challenges in long document generation conditioned on input tables include ensuring coherent output, staying faithful to the input, ensuring fluent output and avoiding repetition of text. Such aspects can be verified on models trained on this dataset",
|
113 |
-
"sole-language-task-dataset": "no",
|
114 |
-
"model-ability": "Long document generation, coherent ordering of information, faithfulness to the input statistics, fluency in generation and avoiding repetition of text."
|
115 |
-
},
|
116 |
-
"curation": {
|
117 |
-
"has-additional-curation": "yes",
|
118 |
-
"modification-types": [
|
119 |
-
"data points removed"
|
120 |
-
],
|
121 |
-
"modification-description": "Some examples have been removed from training dataset which satisfied the below criteria:\n1. The examples in training dataset which overlapped with validation/test.\n2. Some examples which described washed out games. \n\n",
|
122 |
-
"has-additional-splits": "no",
|
123 |
-
"additional-splits-description": "N/A",
|
124 |
-
"additional-splits-capacicites": "N/A"
|
125 |
-
},
|
126 |
-
"starting": {
|
127 |
-
"research-pointers": "The [research paper](https://aclanthology.org/P19-1195) is a good resource"
|
128 |
-
}
|
129 |
-
},
|
130 |
-
"results": {
|
131 |
-
"results": {
|
132 |
-
"other-metrics-definitions": "Wiseman et al. (2017) define three metrics induced from the outputs of an Information Extraction model which is run on the model/human-written game summaries . Let \u0177 be the gold summary and y the model output.\n\u2022 Relation Generation (RG) measures the precision and count of relations extracted from y that also appear in records r.\n\u2022 Content Selection (CS) measures the precision and recall of relations extracted from y that are also extracted from \u0177.\n\u2022 Content Ordering (CO) measures the complement of the normalized Damerau-Levenshtein distance (Brill and Moore, 2000) between the sequences of relations extracted from y and \u0177",
|
133 |
-
"has-previous-results": "yes",
|
134 |
-
"current-evaluation": "N/A",
|
135 |
-
"previous-results": "The most relevant previous results for dataset are in the TACL 2021 paper on [Data-to-text Generation with Macro Planning](https://direct.mit.edu/tacl/article/doi/10.1162/tacl_a_00381/101876/Data-to-text-Generation-with-Macro-Planning)",
|
136 |
-
"metrics": [
|
137 |
-
"Other: Other Metrics"
|
138 |
-
],
|
139 |
-
"original-evaluation": "We have reused the automatic metrics based on Information Extraction evaluation introduced by Wiseman et al (2017). For human evaluation, we conducted studies to evaluate the factuality, coherence, grammaticality and conciseness.",
|
140 |
-
"model-abilities": "Automatic evaluation measure can evaluate the factuality, content selection, content ordering and the fluency of the model output. The factuality, content selection and content ordering is measured using an Information Extraction based evaluation approach introduced by Wiseman et al (2017). The fluency is measured using BLEU."
|
141 |
-
}
|
142 |
-
},
|
143 |
-
"considerations": {
|
144 |
-
"pii": {
|
145 |
-
"risks-description": "N/A"
|
146 |
-
},
|
147 |
-
"licenses": {
|
148 |
-
"dataset-restrictions-other": "N/A",
|
149 |
-
"data-copyright-other": "N/A",
|
150 |
-
"dataset-restrictions": [
|
151 |
-
"research use only"
|
152 |
-
],
|
153 |
-
"data-copyright": [
|
154 |
-
"research use only"
|
155 |
-
]
|
156 |
-
},
|
157 |
-
"limitations": {}
|
158 |
-
},
|
159 |
-
"context": {
|
160 |
-
"previous": {
|
161 |
-
"is-deployed": "no",
|
162 |
-
"described-risks": "N/A",
|
163 |
-
"changes-from-observation": "N/A"
|
164 |
-
},
|
165 |
-
"underserved": {
|
166 |
-
"helps-underserved": "no",
|
167 |
-
"underserved-description": "N/A"
|
168 |
-
},
|
169 |
-
"biases": {
|
170 |
-
"has-biases": "unsure",
|
171 |
-
"bias-analyses": "N/A"
|
172 |
-
}
|
173 |
-
}
|
174 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mlb_data_to_text.py
DELETED
@@ -1,478 +0,0 @@
|
|
1 |
-
|
2 |
-
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
3 |
-
#
|
4 |
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
-
# you may not use this file except in compliance with the License.
|
6 |
-
# You may obtain a copy of the License at
|
7 |
-
#
|
8 |
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
-
#
|
10 |
-
# Unless required by applicable law or agreed to in writing, software
|
11 |
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
-
# See the License for the specific language governing permissions and
|
14 |
-
# limitations under the License.
|
15 |
-
"""TODO: Add a description here."""
|
16 |
-
|
17 |
-
|
18 |
-
import csv
|
19 |
-
import json
|
20 |
-
import os
|
21 |
-
import re
|
22 |
-
|
23 |
-
import datasets
|
24 |
-
|
25 |
-
|
26 |
-
_CITATION = """\
|
27 |
-
@inproceedings{puduppully-etal-2019-data,
|
28 |
-
title = "Data-to-text Generation with Entity Modeling",
|
29 |
-
author = "Puduppully, Ratish and
|
30 |
-
Dong, Li and
|
31 |
-
Lapata, Mirella",
|
32 |
-
booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
|
33 |
-
month = jul,
|
34 |
-
year = "2019",
|
35 |
-
address = "Florence, Italy",
|
36 |
-
publisher = "Association for Computational Linguistics",
|
37 |
-
url = "https://www.aclweb.org/anthology/P19-1195",
|
38 |
-
doi = "10.18653/v1/P19-1195",
|
39 |
-
pages = "2023--2035",
|
40 |
-
}
|
41 |
-
"""
|
42 |
-
|
43 |
-
_DESCRIPTION = """\
|
44 |
-
The MLB dataset for data to text generation contains Major League Baseball games statistics and
|
45 |
-
their human-written summaries.
|
46 |
-
"""
|
47 |
-
|
48 |
-
_HOMEPAGE = "https://github.com/ratishsp/mlb-data-scripts"
|
49 |
-
|
50 |
-
_LICENSE = ""
|
51 |
-
|
52 |
-
_URL = "data.zip"
|
53 |
-
|
54 |
-
team_verbalization_map = {"team_errors": "<TEAM_ERRORS>", "team_hits": "<TEAM_HITS>", "team_runs": "<TEAM_RUNS>"}
|
55 |
-
pitcher_verbalization_map = {"p_bb": "<PITCH-BASE-ON-BALLS>", "p_er": "<EARNED-RUN>", "p_era": "<EARNED-RUN-AVG>",
|
56 |
-
"p_h": "<PITCH-HITS>", "p_hr": "<PITCH-HOME-RUN>", "p_l": "<PITCH-LOSS>",
|
57 |
-
"p_loss": "<PITCH-LOSING-PITCHER>", "p_s": "<PITCH-STRIKES-THROWN>",
|
58 |
-
"p_np": "<PITCH-COUNT>", "p_r": "<PITCH-RUNS>", "p_save": "<PITCH-SAVING-PITCHER>",
|
59 |
-
"p_so": "<PITCH-STRIKE-OUT>", "p_bf": "<PITCH-BATTERS-FACED>",
|
60 |
-
"p_bs": "<PITCH-BLOWN-SAVE>",
|
61 |
-
"p_sv": "<PITCH-SAVE>", "p_w": "<PITCH-WIN>", "p_ip1": "<INNINGS-PITCHED-1>",
|
62 |
-
"p_ip2": "<INNINGS-PITCHED-2>", "p_win": "<PITCH-WINNING-PITCHER>",
|
63 |
-
"p_out": "<PITCH-OUT>"}
|
64 |
-
batter_verbalization_map = {"h": "<HITS>", "r": "<RUNS>", "hr": "<HOME-RUN>", "ab": "<ATBAT>", "avg": "<AVG>",
|
65 |
-
"rbi": "<RBI>", "cs": "<CAUGHT-STEAL>", "hbp": "<HIT-BY-PITCH>", "a": "<ASSIST>",
|
66 |
-
"bb": "<BASE-ON-BALL>", "e": "<ERROR>", "obp": "<ON-BASE-PCT>", "po": "<PUTOUT>",
|
67 |
-
"pos": "<POS>", "sb": "<STOLEN-BASE>", "sf": "<SAC-FLY>", "slg": "<SLUG>",
|
68 |
-
"so": "<STRIKEOUT>"
|
69 |
-
}
|
70 |
-
pbyp_verbalization_map = {"o": "<PBYP-OUTS>", "b": "<PBYP-BALLS>", "s": "<PBYP-STRIKES>", "b1": "<PBYP-B1>",
|
71 |
-
"b2": "<PBYP-B2>", "b3": "<PBYP-B3>", "batter": "<PBYP-BATTER>",
|
72 |
-
"pitcher": "<PBYP-PITCHER>",
|
73 |
-
"scorers": "<PBYP-SCORERS>", "event": "<PBYP-EVENT>", "event2": "<PBYP-EVENT2>",
|
74 |
-
"fielder_error": "<PBYP-FIELDER-ERROR>", "runs": "<PBYP-RUNS>", "rbi": "<PBYP-RBI>",
|
75 |
-
"error_runs": "<PBYP-ERROR-RUNS>", "top": "<TOP>", "bottom": "<BOTTOM>"}
|
76 |
-
|
77 |
-
player_verbalization_map = dict(pitcher_verbalization_map, **batter_verbalization_map)
|
78 |
-
|
79 |
-
|
80 |
-
class MlbDataToText(datasets.GeneratorBasedBuilder):
|
81 |
-
"""MLB dataset for data to text generation"""
|
82 |
-
|
83 |
-
VERSION = datasets.Version("1.1.0")
|
84 |
-
|
85 |
-
def _info(self):
|
86 |
-
features = datasets.Features(
|
87 |
-
{
|
88 |
-
"home_name": datasets.Value("string"),
|
89 |
-
"box_score": [
|
90 |
-
{
|
91 |
-
"p_l": datasets.Value("string"),
|
92 |
-
"last_name": datasets.Value("string"),
|
93 |
-
"p_h": datasets.Value("string"),
|
94 |
-
"sac": datasets.Value("string"),
|
95 |
-
"p_bb": datasets.Value("string"),
|
96 |
-
"pos": datasets.Value("string"),
|
97 |
-
"ao": datasets.Value("string"),
|
98 |
-
"p_bf": datasets.Value("string"),
|
99 |
-
"cs": datasets.Value("string"),
|
100 |
-
"hbp": datasets.Value("string"),
|
101 |
-
"ab": datasets.Value("string"),
|
102 |
-
"full_name": datasets.Value("string"),
|
103 |
-
"p_w": datasets.Value("string"),
|
104 |
-
"go": datasets.Value("string"),
|
105 |
-
"fldg": datasets.Value("string"),
|
106 |
-
"p_bs": datasets.Value("string"),
|
107 |
-
"avg": datasets.Value("string"),
|
108 |
-
"p_r": datasets.Value("string"),
|
109 |
-
"p_s": datasets.Value("string"),
|
110 |
-
"lob": datasets.Value("string"),
|
111 |
-
"first_name": datasets.Value("string"),
|
112 |
-
"p_sv": datasets.Value("string"),
|
113 |
-
"p_so": datasets.Value("string"),
|
114 |
-
"p_save": datasets.Value("string"),
|
115 |
-
"p_hr": datasets.Value("string"),
|
116 |
-
"po": datasets.Value("string"),
|
117 |
-
"p_ip1": datasets.Value("string"),
|
118 |
-
"p_ip2": datasets.Value("string"),
|
119 |
-
"bb": datasets.Value("string"),
|
120 |
-
"ops": datasets.Value("string"),
|
121 |
-
"p_hld": datasets.Value("string"),
|
122 |
-
"bo": datasets.Value("string"),
|
123 |
-
"p_loss": datasets.Value("string"),
|
124 |
-
"e": datasets.Value("string"),
|
125 |
-
"p_game_score": datasets.Value("string"),
|
126 |
-
"p_win": datasets.Value("string"),
|
127 |
-
"a": datasets.Value("string"),
|
128 |
-
"p_era": datasets.Value("string"),
|
129 |
-
"d": datasets.Value("string"),
|
130 |
-
"p_out": datasets.Value("string"),
|
131 |
-
"h": datasets.Value("string"),
|
132 |
-
"p_er": datasets.Value("string"),
|
133 |
-
"p_np": datasets.Value("string"),
|
134 |
-
"hr": datasets.Value("string"),
|
135 |
-
"r": datasets.Value("string"),
|
136 |
-
"so": datasets.Value("string"),
|
137 |
-
"t": datasets.Value("string"),
|
138 |
-
"rbi": datasets.Value("string"),
|
139 |
-
"team": datasets.Value("string"),
|
140 |
-
"sb": datasets.Value("string"),
|
141 |
-
"slg": datasets.Value("string"),
|
142 |
-
"sf": datasets.Value("string"),
|
143 |
-
"obp": datasets.Value("string"),
|
144 |
-
}
|
145 |
-
],
|
146 |
-
"home_city": datasets.Value("string"),
|
147 |
-
"vis_name": datasets.Value("string"),
|
148 |
-
"play_by_play": [{
|
149 |
-
"top": [{
|
150 |
-
"runs": datasets.Value("string"),
|
151 |
-
"scorers": [
|
152 |
-
datasets.Value("string")
|
153 |
-
],
|
154 |
-
"pitcher": datasets.Value("string"),
|
155 |
-
"o": datasets.Value("string"),
|
156 |
-
"b": datasets.Value("string"),
|
157 |
-
"s": datasets.Value("string"),
|
158 |
-
"batter": datasets.Value("string"),
|
159 |
-
"b1": [
|
160 |
-
datasets.Value("string")
|
161 |
-
],
|
162 |
-
"b2": [
|
163 |
-
datasets.Value("string")
|
164 |
-
],
|
165 |
-
"b3": [
|
166 |
-
datasets.Value("string")
|
167 |
-
],
|
168 |
-
"event": datasets.Value("string"),
|
169 |
-
"event2": datasets.Value("string"),
|
170 |
-
"home_team_runs": datasets.Value("string"),
|
171 |
-
"away_team_runs": datasets.Value("string"),
|
172 |
-
"rbi": datasets.Value("string"),
|
173 |
-
"error_runs": datasets.Value("string"),
|
174 |
-
"fielder_error": datasets.Value("string")
|
175 |
-
}
|
176 |
-
],
|
177 |
-
"bottom": [{
|
178 |
-
"runs": datasets.Value("string"),
|
179 |
-
"scorers": [
|
180 |
-
datasets.Value("string")
|
181 |
-
],
|
182 |
-
"pitcher": datasets.Value("string"),
|
183 |
-
"o": datasets.Value("string"),
|
184 |
-
"b": datasets.Value("string"),
|
185 |
-
"s": datasets.Value("string"),
|
186 |
-
"batter": datasets.Value("string"),
|
187 |
-
"b1": [
|
188 |
-
datasets.Value("string")
|
189 |
-
],
|
190 |
-
"b2": [
|
191 |
-
datasets.Value("string")
|
192 |
-
],
|
193 |
-
"b3": [
|
194 |
-
datasets.Value("string")
|
195 |
-
],
|
196 |
-
"event": datasets.Value("string"),
|
197 |
-
"event2": datasets.Value("string"),
|
198 |
-
"home_team_runs": datasets.Value("string"),
|
199 |
-
"away_team_runs": datasets.Value("string"),
|
200 |
-
"rbi": datasets.Value("string"),
|
201 |
-
"error_runs": datasets.Value("string"),
|
202 |
-
"fielder_error": datasets.Value("string")
|
203 |
-
}
|
204 |
-
],
|
205 |
-
"inning": datasets.Value("string")
|
206 |
-
}
|
207 |
-
],
|
208 |
-
"vis_line": {
|
209 |
-
"innings": [{
|
210 |
-
"inn": datasets.Value("string"),
|
211 |
-
"runs": datasets.Value("string")
|
212 |
-
}
|
213 |
-
],
|
214 |
-
"result": datasets.Value("string"),
|
215 |
-
"team_runs": datasets.Value("string"),
|
216 |
-
"team_hits": datasets.Value("string"),
|
217 |
-
"team_errors": datasets.Value("string"),
|
218 |
-
"team_name": datasets.Value("string"),
|
219 |
-
"team_city": datasets.Value("string")
|
220 |
-
},
|
221 |
-
"home_line": {
|
222 |
-
"innings": [{
|
223 |
-
"inn": datasets.Value("string"),
|
224 |
-
"runs": datasets.Value("string")
|
225 |
-
}
|
226 |
-
],
|
227 |
-
"result": datasets.Value("string"),
|
228 |
-
"team_runs": datasets.Value("string"),
|
229 |
-
"team_hits": datasets.Value("string"),
|
230 |
-
"team_errors": datasets.Value("string"),
|
231 |
-
"team_name": datasets.Value("string"),
|
232 |
-
"team_city": datasets.Value("string")
|
233 |
-
},
|
234 |
-
"vis_city": datasets.Value("string"),
|
235 |
-
"day": datasets.Value("string"),
|
236 |
-
"summary": [
|
237 |
-
datasets.Value("string"),
|
238 |
-
],
|
239 |
-
"summary_eval": datasets.Value("string"),
|
240 |
-
"gem_id": datasets.Value("string"),
|
241 |
-
"target": datasets.Value("string"),
|
242 |
-
"references": [datasets.Value("string")],
|
243 |
-
"linearized_input": datasets.Value("string")
|
244 |
-
}
|
245 |
-
)
|
246 |
-
return datasets.DatasetInfo(
|
247 |
-
description=_DESCRIPTION,
|
248 |
-
features=features,
|
249 |
-
supervised_keys=None,
|
250 |
-
homepage=_HOMEPAGE,
|
251 |
-
license=_LICENSE,
|
252 |
-
citation=_CITATION,
|
253 |
-
)
|
254 |
-
|
255 |
-
def _split_generators(self, dl_manager):
|
256 |
-
"""Returns SplitGenerators."""
|
257 |
-
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
258 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
259 |
-
|
260 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
|
261 |
-
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
262 |
-
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
263 |
-
data_dir = dl_manager.download_and_extract(_URL)
|
264 |
-
return [
|
265 |
-
datasets.SplitGenerator(
|
266 |
-
name=datasets.Split.TRAIN,
|
267 |
-
# These kwargs will be passed to _generate_examples
|
268 |
-
gen_kwargs={
|
269 |
-
"filepath": os.path.join(data_dir, "data", "train.jsonl"),
|
270 |
-
"split": "train",
|
271 |
-
},
|
272 |
-
),
|
273 |
-
datasets.SplitGenerator(
|
274 |
-
name=datasets.Split.TEST,
|
275 |
-
# These kwargs will be passed to _generate_examples
|
276 |
-
gen_kwargs={
|
277 |
-
"filepath": os.path.join(data_dir, "data", "test.jsonl"),
|
278 |
-
"split": "test"
|
279 |
-
},
|
280 |
-
),
|
281 |
-
datasets.SplitGenerator(
|
282 |
-
name=datasets.Split.VALIDATION,
|
283 |
-
# These kwargs will be passed to _generate_examples
|
284 |
-
gen_kwargs={
|
285 |
-
"filepath": os.path.join(data_dir, "data", "validation.jsonl"),
|
286 |
-
"split": "validation",
|
287 |
-
},
|
288 |
-
),
|
289 |
-
]
|
290 |
-
|
291 |
-
def tokenize_initials(self, value):
|
292 |
-
attrib_value = re.sub(r"(\w)\.(\w)\.", r"\g<1>. \g<2>.", value)
|
293 |
-
return attrib_value
|
294 |
-
|
295 |
-
def get_team_line_attributes(self, entry, name):
|
296 |
-
if name == entry["home_line"]["team_name"]:
|
297 |
-
line = entry["home_line"]
|
298 |
-
type = "home"
|
299 |
-
elif name == entry["vis_line"]["team_name"]:
|
300 |
-
line = entry["vis_line"]
|
301 |
-
type = "vis"
|
302 |
-
else:
|
303 |
-
assert False
|
304 |
-
|
305 |
-
city = line["team_city"]
|
306 |
-
name = line["team_name"]
|
307 |
-
result = line["result"]
|
308 |
-
updated_type = "<" + type.upper() + ">"
|
309 |
-
team_tup = (updated_type, name, city, result)
|
310 |
-
team_line = "%s <TEAM> %s <CITY> %s <TEAM-RESULT> %s"
|
311 |
-
sentence1 = team_line % (team_tup)
|
312 |
-
other_attributes = []
|
313 |
-
attributes = ["team_runs", "team_hits", "team_errors"]
|
314 |
-
for attrib in attributes:
|
315 |
-
template_string = " ".join([team_verbalization_map[attrib], "%s"])
|
316 |
-
other_attributes.append(template_string % line[attrib])
|
317 |
-
other_attributes = " ".join(other_attributes)
|
318 |
-
team_info = sentence1
|
319 |
-
if len(other_attributes) > 0:
|
320 |
-
team_info = " ".join([sentence1, other_attributes])
|
321 |
-
innings = line["innings"]
|
322 |
-
inning_verbalization = []
|
323 |
-
for inning in innings:
|
324 |
-
inning_phrase = "<INN> %s %s" % (inning["inn"], inning["runs"])
|
325 |
-
inning_verbalization.append(inning_phrase)
|
326 |
-
inning_sentence = " ".join(inning_verbalization)
|
327 |
-
team_info = " ".join([team_info, inning_sentence])
|
328 |
-
return team_info
|
329 |
-
|
330 |
-
def get_player_line(self, entry):
|
331 |
-
players = []
|
332 |
-
for player in entry["box_score"]:
|
333 |
-
if player["full_name"] == "N/A":
|
334 |
-
continue
|
335 |
-
player_line = "<PLAYER> %s <TEAM> %s <POS> %s"
|
336 |
-
player_tup = (self.tokenize_initials(player["full_name"]), player["team"], player["pos"])
|
337 |
-
player_basic_info = player_line % (player_tup)
|
338 |
-
other_attributes = []
|
339 |
-
for attrib in ["r", "h", "hr", "rbi", "e", "ab", "avg", "cs", "hbp", "bb", "sb", "sf", "so", "a", "po",
|
340 |
-
"p_ip1", "p_ip2", "p_w", "p_l", "p_h", "p_r", "p_er", "p_bb", "p_so", "p_hr", "p_np", "p_s",
|
341 |
-
"p_era", "p_win", "p_loss", "p_save", "p_sv", "p_bf", "p_out", "p_bs"]:
|
342 |
-
if player[attrib] == "N/A":
|
343 |
-
continue
|
344 |
-
if attrib in ['sb', 'sf', 'e', 'po', 'a', 'cs', 'hbp', 'hr', 'so', 'bb', "p_hr", "p_sv",
|
345 |
-
"p_bs"] and int(player[attrib]) == 0:
|
346 |
-
continue
|
347 |
-
if attrib in ['avg'] and player[attrib] == ".000":
|
348 |
-
continue
|
349 |
-
template_string = " ".join([player_verbalization_map[attrib], "%s"])
|
350 |
-
other_attributes.append(template_string % (player[attrib]))
|
351 |
-
player_other_attributes = " ".join(other_attributes)
|
352 |
-
if other_attributes:
|
353 |
-
player_info = " ".join([player_basic_info, player_other_attributes])
|
354 |
-
else:
|
355 |
-
player_info = player_basic_info
|
356 |
-
|
357 |
-
players.append(player_info)
|
358 |
-
return players
|
359 |
-
|
360 |
-
def get_runs_desc(self, inning_play):
|
361 |
-
obs_desc = []
|
362 |
-
for attrib in ["runs", "rbi", "error_runs"]:
|
363 |
-
if attrib in inning_play and inning_play[attrib] != "N/A" and int(inning_play[attrib]) > 0:
|
364 |
-
desc = " ".join([pbyp_verbalization_map[attrib], "%d"])
|
365 |
-
obs_desc.append(desc % (int(inning_play[attrib])))
|
366 |
-
return obs_desc
|
367 |
-
|
368 |
-
def get_obs_desc(self, inning_play):
|
369 |
-
obs_desc = []
|
370 |
-
for attrib in ["o", "b", "s"]:
|
371 |
-
if attrib in inning_play:
|
372 |
-
desc = " ".join([pbyp_verbalization_map[attrib], "%d"])
|
373 |
-
obs_desc.append(desc % (int(inning_play[attrib])))
|
374 |
-
return obs_desc
|
375 |
-
|
376 |
-
def get_name_desc(self, attrib, inning_play, obs_desc):
|
377 |
-
if attrib in inning_play:
|
378 |
-
desc = " ".join([pbyp_verbalization_map[attrib], "%s"])
|
379 |
-
attrib_value = self.tokenize_initials(inning_play[attrib])
|
380 |
-
obs_desc.append(desc % (attrib_value))
|
381 |
-
|
382 |
-
def get_name_desc_entity(self, attrib, entity_name, obs_desc):
|
383 |
-
desc = " ".join([pbyp_verbalization_map[attrib], "%s"])
|
384 |
-
attrib_value = self.tokenize_initials(entity_name)
|
385 |
-
obs_desc.append(desc % (attrib_value))
|
386 |
-
|
387 |
-
def get_team_scores_desc(self, away, home, inning_play, obs_desc):
|
388 |
-
if "home_team_runs" in inning_play and "away_team_runs" in inning_play and inning_play[
|
389 |
-
"home_team_runs"] != "N/A" and inning_play["away_team_runs"] != "N/A":
|
390 |
-
desc = "<TEAM-SCORES> %s %d %s %d" % (
|
391 |
-
home, int(inning_play["home_team_runs"]), away, int(inning_play["away_team_runs"]))
|
392 |
-
obs_desc.append(desc)
|
393 |
-
|
394 |
-
def get_attrib_value_desc(self, attrib, inning_play, obs_desc):
|
395 |
-
if attrib in inning_play and inning_play[attrib] != "N/A":
|
396 |
-
desc = " ".join([pbyp_verbalization_map[attrib], "%s"])
|
397 |
-
obs_desc.append(desc % (inning_play[attrib]))
|
398 |
-
|
399 |
-
def get_play_by_play_desc(self, home, away, inning, inning_play, play_index,
|
400 |
-
top_bottom):
|
401 |
-
inning_line = " ".join(
|
402 |
-
["<INNING> %s", pbyp_verbalization_map[top_bottom], "<BATTING> %s <PITCHING> %s <PLAY> %d"])
|
403 |
-
if top_bottom == "top":
|
404 |
-
inning_attrib = (inning, away, home, play_index)
|
405 |
-
else:
|
406 |
-
inning_attrib = (inning, home, away, play_index)
|
407 |
-
inning_desc = inning_line % (inning_attrib)
|
408 |
-
other_attrib_desc = [inning_desc]
|
409 |
-
other_attrib_desc.extend(self.get_runs_desc(inning_play))
|
410 |
-
other_attrib_desc.extend(self.get_obs_desc(inning_play))
|
411 |
-
for attrib in ["batter", "pitcher", "fielder_error"]:
|
412 |
-
if attrib in inning_play and inning_play[attrib] != "N/A":
|
413 |
-
self.get_name_desc(attrib, inning_play, other_attrib_desc)
|
414 |
-
for attrib in ["scorers", "b2", "b3"]:
|
415 |
-
if attrib in inning_play and len(inning_play[attrib]) > 0 and inning_play[attrib][0] != "N/A":
|
416 |
-
for baserunner_instance in inning_play[attrib]:
|
417 |
-
self.get_name_desc_entity(attrib, baserunner_instance, other_attrib_desc)
|
418 |
-
self.get_attrib_value_desc("event", inning_play, other_attrib_desc)
|
419 |
-
self.get_attrib_value_desc("event2", inning_play, other_attrib_desc)
|
420 |
-
self.get_team_scores_desc(away, home, inning_play, other_attrib_desc)
|
421 |
-
return other_attrib_desc
|
422 |
-
|
423 |
-
def get_play_by_play_all_entities_inning(self, inning_data, home, away, inning, side):
|
424 |
-
play_by_play_desc = []
|
425 |
-
|
426 |
-
play_index = 1
|
427 |
-
inning_plays = inning_data[side]
|
428 |
-
for inning_play in inning_plays:
|
429 |
-
other_attrib_desc = self.get_play_by_play_desc(home, away, inning, inning_play, play_index, side)
|
430 |
-
other_attrib_desc = " ".join(other_attrib_desc)
|
431 |
-
play_index += 1
|
432 |
-
play_by_play_desc.append(other_attrib_desc)
|
433 |
-
return play_by_play_desc
|
434 |
-
|
435 |
-
def linearize_input(self, entry):
|
436 |
-
output = []
|
437 |
-
output.append(self.get_team_line_attributes(entry, entry["home_line"]["team_name"]))
|
438 |
-
output.append(self.get_team_line_attributes(entry, entry["vis_line"]["team_name"]))
|
439 |
-
output.extend(self.get_player_line(entry))
|
440 |
-
for inning_data in entry['play_by_play']:
|
441 |
-
for side in ["top", "bottom"]:
|
442 |
-
pbyp_desc = self.get_play_by_play_all_entities_inning(inning_data, entry["home_line"]["team_name"],
|
443 |
-
entry["vis_line"]["team_name"], inning_data['inning'],
|
444 |
-
side)
|
445 |
-
if pbyp_desc:
|
446 |
-
output.append(" ".join(pbyp_desc))
|
447 |
-
|
448 |
-
linearized_input = " ".join(output)
|
449 |
-
linearized_input = linearized_input.replace(" ", " ")
|
450 |
-
return linearized_input
|
451 |
-
|
452 |
-
def _generate_examples(
|
453 |
-
self, filepath, split # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
454 |
-
):
|
455 |
-
""" Yields examples as (key, example) tuples. """
|
456 |
-
# This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
457 |
-
# The `key` is here for legacy reason (tfds) and is not important in itself.
|
458 |
-
|
459 |
-
with open(filepath, encoding="utf-8") as f:
|
460 |
-
for id_, row in enumerate(f):
|
461 |
-
data = json.loads(row)
|
462 |
-
yield id_, {
|
463 |
-
"home_name": data["home_name"],
|
464 |
-
"box_score": data["box_score"],
|
465 |
-
"home_city": data["home_city"],
|
466 |
-
"vis_name": data["vis_name"],
|
467 |
-
"play_by_play": data["play_by_play"],
|
468 |
-
"vis_line": data["vis_line"],
|
469 |
-
"vis_city": data["vis_city"],
|
470 |
-
"day": data["day"],
|
471 |
-
"home_line": data["home_line"],
|
472 |
-
"summary": data["summary"],
|
473 |
-
"summary_eval": data["summary_eval"],
|
474 |
-
"gem_id": data["gem_id"],
|
475 |
-
"target": data["summary_eval"],
|
476 |
-
"references": [data["summary_eval"]],
|
477 |
-
"linearized_input": self.linearize_input(data)
|
478 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|