system HF staff commited on
Commit
a187759
0 Parent(s):

Update files from the datasets library (from 1.3.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.3.0

.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - expert-generated
4
+ language_creators:
5
+ - crowdsourced
6
+ languages:
7
+ - en
8
+ licenses:
9
+ - cc-by-4-0
10
+ multilinguality:
11
+ - monolingual
12
+ size_categories:
13
+ - 100K<n<1M
14
+ source_datasets:
15
+ - original
16
+ task_categories:
17
+ - sequence-modeling
18
+ - structure-prediction
19
+ task_ids:
20
+ - coreference-resolution
21
+ - dialogue-modeling
22
+ ---
23
+
24
+ # Dataset Card for IRC Disentanglement
25
+
26
+ ## Table of Contents
27
+ - [Dataset Description](#dataset-description)
28
+ - [Dataset Summary](#dataset-summary)
29
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
30
+ - [Languages](#languages)
31
+ - [Dataset Structure](#dataset-structure)
32
+ - [Data Instances](#data-instances)
33
+ - [Data Fields](#data-instances)
34
+ - [Data Splits](#data-instances)
35
+ - [Dataset Creation](#dataset-creation)
36
+ - [Curation Rationale](#curation-rationale)
37
+ - [Source Data](#source-data)
38
+ - [Annotations](#annotations)
39
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
40
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
41
+ - [Social Impact of Dataset](#social-impact-of-dataset)
42
+ - [Discussion of Biases](#discussion-of-biases)
43
+ - [Other Known Limitations](#other-known-limitations)
44
+ - [Additional Information](#additional-information)
45
+ - [Dataset Curators](#dataset-curators)
46
+ - [Licensing Information](#licensing-information)
47
+ - [Citation Information](#citation-information)
48
+ - [Contributions](#contributions)
49
+
50
+ ## Dataset Description
51
+
52
+ - **Homepage:** https://jkk.name/irc-disentanglement/
53
+ - **Repository:** https://github.com/jkkummerfeld/irc-disentanglement/tree/master/data
54
+ - **Paper:** https://aclweb.org/anthology/papers/P/P19/P19-1374/
55
+ - **Leaderboard:** NA
56
+ - **Point of Contact:** jkummerf@umich.edu
57
+
58
+ ### Dataset Summary
59
+
60
+ Disentangling conversations mixed together in a single stream of messages is a difficult task, made harder by the lack of large manually annotated datasets. This new dataset of 77,563 messages manually annotated with reply-structure graphs that both disentangle conversations and define internal conversation structure. The dataset is 16 times larger than all previously released datasets combined, the first to include adjudication of annotation disagreements, and the first to include context.
61
+
62
+ ### Supported Tasks and Leaderboards
63
+
64
+ Conversational Disentanglement, Coreference Resolution, Dialogue Modeling
65
+
66
+ ### Languages
67
+
68
+ English (en)
69
+
70
+ ## Dataset Structure
71
+
72
+ ### Data Instances
73
+
74
+ For Ubuntu:
75
+
76
+ data["train"][1050]
77
+
78
+ ```
79
+ {
80
+
81
+ 'ascii': "[03:57] <Xophe> (also, I'm guessing that this isn't a good place to report minor but annoying bugs... what is?)",
82
+
83
+ 'connections': [1048, 1054, 1055, 1072, 1073],
84
+
85
+ 'date': '2004-12-25',
86
+
87
+ 'id': 1050,
88
+
89
+ 'raw': "[03:57] <Xophe> (also, I'm guessing that this isn't a good place to report minor but annoying bugs... what is?)",
90
+
91
+ 'tokenized': "<s> ( also , i 'm guessing that this is n't a good place to report minor but annoying bugs ... what is ?) </s>"
92
+
93
+ }
94
+ ```
95
+
96
+ For Channel_two:
97
+
98
+ data["train"][50]
99
+
100
+ ```
101
+ {
102
+
103
+ 'ascii': "[01:04] <Felicia> Chanel: i don't know off hand sorry",
104
+
105
+ 'connections': [49, 53],
106
+
107
+ 'id': 50,
108
+
109
+ 'raw': "[01:04] <Felicia> Chanel: i don't know off hand sorry",
110
+
111
+ 'tokenized': "<s> <user> : i do n't know off hand sorry </s>"
112
+
113
+ }
114
+ ```
115
+
116
+ ### Data Fields
117
+
118
+ 'id' : The id of the message, this is the value that would be in the 'connections' of associated messages.
119
+
120
+ 'raw' : The original message from the IRC log, as downloaded.
121
+
122
+ 'ascii' : The raw message converted to ascii (unconvertable characters are replaced with a special word).
123
+
124
+ 'tokenized' : The same message with automatic tokenisation and replacement of rare words with placeholder symbols.
125
+
126
+ 'connections' : The indices of linked messages.
127
+
128
+ (only ubuntu) 'date' : The date the messages are from. The labelling for each date only start after the first 1000 messages of that date.
129
+
130
+ ### Data Splits
131
+
132
+ ubuntu: This data split is a new dataset introduced by the authors which labels connected messages in an online chatroom about ubuntu.
133
+
134
+ channel_two: This data split is a re-analysis of prior work on IRC-Disentanglement where issues about the previous data are resolved. The previous dataset is outlined in https://www.aclweb.org/anthology/P08-1095.pdf.
135
+
136
+ ## Dataset Creation
137
+
138
+ ### Curation Rationale
139
+
140
+ [More Information Needed]
141
+
142
+ ### Source Data
143
+
144
+ #### Initial Data Collection and Normalization
145
+
146
+ [More Information Needed]
147
+
148
+ #### Who are the source language producers?
149
+
150
+ [More Information Needed]
151
+
152
+ ### Annotations
153
+
154
+ #### Annotation process
155
+
156
+ [More Information Needed]
157
+
158
+ #### Who are the annotators?
159
+
160
+ [More Information Needed]
161
+
162
+ ### Personal and Sensitive Information
163
+
164
+ [More Information Needed]
165
+
166
+ ## Considerations for Using the Data
167
+
168
+ ### Social Impact of Dataset
169
+
170
+ [More Information Needed]
171
+
172
+ ### Discussion of Biases
173
+
174
+ [More Information Needed]
175
+
176
+ ### Other Known Limitations
177
+
178
+ [More Information Needed]
179
+
180
+ ## Additional Information
181
+
182
+ ### Dataset Curators
183
+
184
+ Jonathan K. Kummerfeld, Sai R. Gouravajhala, Joseph Peper, Vignesh Athreya, Chulaka Gunasekara, Jatin Ganhotra, Siva Sankalp Patel, Lazaros Polymenakos, and Walter S. Lasecki
185
+
186
+ ### Licensing Information
187
+
188
+ Creative Commons Attribution 4.0
189
+
190
+ ### Citation Information
191
+
192
+ @InProceedings{acl19disentangle,
193
+ author = {Jonathan K. Kummerfeld and Sai R. Gouravajhala and Joseph Peper and Vignesh Athreya and Chulaka Gunasekara and Jatin Ganhotra and Siva Sankalp Patel and Lazaros Polymenakos and Walter S. Lasecki},
194
+ title = {A Large-Scale Corpus for Conversation Disentanglement},
195
+ booktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},
196
+ location = {Florence, Italy},
197
+ month = {July},
198
+ year = {2019},
199
+ doi = {10.18653/v1/P19-1374},
200
+ pages = {3846--3856},
201
+ url = {https://aclweb.org/anthology/papers/P/P19/P19-1374/},
202
+ arxiv = {https://arxiv.org/abs/1810.11118},
203
+ software = {https://jkk.name/irc-disentanglement},
204
+ data = {https://jkk.name/irc-disentanglement},
205
+ }
206
+
207
+ ### Contributions
208
+
209
+ Thanks to [@dhruvjoshi1998](https://github.com/dhruvjoshi1998) for adding this dataset.
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"ubuntu": {"description": "Disentangling conversations mixed together in a single stream of messages is\na difficult task, made harder by the lack of large manually annotated\ndatasets. This new dataset of 77,563 messages manually annotated with\nreply-structure graphs that both disentangle conversations and define\ninternal conversation structure. The dataset is 16 times larger than all\npreviously released datasets combined, the first to include adjudication of\nannotation disagreements, and the first to include context.\n", "citation": "@InProceedings{acl19disentangle,\nauthor = {Jonathan K. Kummerfeld and Sai R. Gouravajhala and Joseph Peper and Vignesh Athreya and Chulaka Gunasekara and Jatin Ganhotra and Siva Sankalp Patel and Lazaros Polymenakos and Walter S. Lasecki},\ntitle = {A Large-Scale Corpus for Conversation Disentanglement},\nbooktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},\nlocation = {Florence, Italy},\nmonth = {July},\nyear = {2019},\ndoi = {10.18653/v1/P19-1374},\npages = {3846--3856},\nurl = {https://aclweb.org/anthology/papers/P/P19/P19-1374/},\narxiv = {https://arxiv.org/abs/1810.11118},\nsoftware = {https://jkk.name/irc-disentanglement},\ndata = {https://jkk.name/irc-disentanglement},\n}\n", "homepage": "https://jkk.name/irc-disentanglement/", "license": "Creative Commons Attribution 4.0 International Public License", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "raw": {"dtype": "string", "id": null, "_type": "Value"}, "ascii": {"dtype": "string", "id": null, "_type": "Value"}, "tokenized": {"dtype": "string", "id": null, "_type": "Value"}, "date": {"dtype": "string", "id": null, "_type": "Value"}, "connections": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "irc_disentangle", "config_name": "ubuntu", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 55970472, "num_examples": 220616, "dataset_name": "irc_disentangle"}, "test": {"name": "test", "num_bytes": 3916881, "num_examples": 15010, "dataset_name": "irc_disentangle"}, "validation": {"name": "validation", "num_bytes": 3079360, "num_examples": 12510, "dataset_name": "irc_disentangle"}}, "download_checksums": {"https://github.com/jkkummerfeld/irc-disentanglement/tarball/master": {"num_bytes": 118470349, "checksum": "9e2c98a15191d729c0dbe10f309d836bd1ab32c0d03ffb2e0e4205287405fc4d"}}, "download_size": 118470349, "post_processing_size": null, "dataset_size": 62966713, "size_in_bytes": 181437062}, "channel_two": {"description": "Disentangling conversations mixed together in a single stream of messages is\na difficult task, made harder by the lack of large manually annotated\ndatasets. This new dataset of 77,563 messages manually annotated with\nreply-structure graphs that both disentangle conversations and define\ninternal conversation structure. The dataset is 16 times larger than all\npreviously released datasets combined, the first to include adjudication of\nannotation disagreements, and the first to include context.\n", "citation": "@InProceedings{acl19disentangle,\nauthor = {Jonathan K. Kummerfeld and Sai R. Gouravajhala and Joseph Peper and Vignesh Athreya and Chulaka Gunasekara and Jatin Ganhotra and Siva Sankalp Patel and Lazaros Polymenakos and Walter S. Lasecki},\ntitle = {A Large-Scale Corpus for Conversation Disentanglement},\nbooktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},\nlocation = {Florence, Italy},\nmonth = {July},\nyear = {2019},\ndoi = {10.18653/v1/P19-1374},\npages = {3846--3856},\nurl = {https://aclweb.org/anthology/papers/P/P19/P19-1374/},\narxiv = {https://arxiv.org/abs/1810.11118},\nsoftware = {https://jkk.name/irc-disentanglement},\ndata = {https://jkk.name/irc-disentanglement},\n}\n", "homepage": "https://jkk.name/irc-disentanglement/", "license": "Creative Commons Attribution 4.0 International Public License", "features": {"id": {"dtype": "int32", "id": null, "_type": "Value"}, "raw": {"dtype": "string", "id": null, "_type": "Value"}, "ascii": {"dtype": "string", "id": null, "_type": "Value"}, "tokenized": {"dtype": "string", "id": null, "_type": "Value"}, "connections": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}, "post_processed": null, "supervised_keys": null, "builder_name": "irc_disentangle", "config_name": "channel_two", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"dev": {"name": "dev", "num_bytes": 197189, "num_examples": 1001, "dataset_name": "irc_disentangle"}, "pilot": {"name": "pilot", "num_bytes": 92514, "num_examples": 501, "dataset_name": "irc_disentangle"}, "test": {"name": "test", "num_bytes": 186494, "num_examples": 1001, "dataset_name": "irc_disentangle"}, "pilot_dev": {"name": "pilot_dev", "num_bytes": 289695, "num_examples": 1501, "dataset_name": "irc_disentangle"}, "all_": {"name": "all_", "num_bytes": 495666, "num_examples": 2602, "dataset_name": "irc_disentangle"}}, "download_checksums": {"https://github.com/jkkummerfeld/irc-disentanglement/tarball/master": {"num_bytes": 118470349, "checksum": "9e2c98a15191d729c0dbe10f309d836bd1ab32c0d03ffb2e0e4205287405fc4d"}}, "download_size": 118470349, "post_processing_size": null, "dataset_size": 1261558, "size_in_bytes": 119731907}}
dummy/channel_two/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a1b5c2585f5c49e8c4266399d52f674dd46baa2adf9abe11c8580b7bd4d469b
3
+ size 14669
dummy/ubuntu/1.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:81944d1b2e274034c077343f94b9cc292bea0e3664050c6fddabbc6fbf5abab3
3
+ size 16543
irc_disentangle.py ADDED
@@ -0,0 +1,281 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
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
+ """Dataset of disentangled IRC"""
16
+
17
+ from __future__ import absolute_import, division, print_function
18
+
19
+ import glob
20
+ import os
21
+ from pathlib import Path
22
+
23
+ import datasets
24
+
25
+
26
+ _CITATION = """\
27
+ @InProceedings{acl19disentangle,
28
+ author = {Jonathan K. Kummerfeld and Sai R. Gouravajhala and Joseph Peper and Vignesh Athreya and Chulaka Gunasekara and Jatin Ganhotra and Siva Sankalp Patel and Lazaros Polymenakos and Walter S. Lasecki},
29
+ title = {A Large-Scale Corpus for Conversation Disentanglement},
30
+ booktitle = {Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics},
31
+ location = {Florence, Italy},
32
+ month = {July},
33
+ year = {2019},
34
+ doi = {10.18653/v1/P19-1374},
35
+ pages = {3846--3856},
36
+ url = {https://aclweb.org/anthology/papers/P/P19/P19-1374/},
37
+ arxiv = {https://arxiv.org/abs/1810.11118},
38
+ software = {https://jkk.name/irc-disentanglement},
39
+ data = {https://jkk.name/irc-disentanglement},
40
+ }
41
+ """
42
+
43
+ _DESCRIPTION = """\
44
+ Disentangling conversations mixed together in a single stream of messages is
45
+ a difficult task, made harder by the lack of large manually annotated
46
+ datasets. This new dataset of 77,563 messages manually annotated with
47
+ reply-structure graphs that both disentangle conversations and define
48
+ internal conversation structure. The dataset is 16 times larger than all
49
+ previously released datasets combined, the first to include adjudication of
50
+ annotation disagreements, and the first to include context.
51
+ """
52
+
53
+ _HOMEPAGE = "https://jkk.name/irc-disentanglement/"
54
+
55
+ _LICENSE = "Creative Commons Attribution 4.0 International Public License"
56
+
57
+ _URL = "https://github.com/jkkummerfeld/irc-disentanglement/tarball/master"
58
+
59
+
60
+ class IRCDisentangle(datasets.GeneratorBasedBuilder):
61
+ """IRCDisentangle dataset"""
62
+
63
+ VERSION = datasets.Version("1.0.0")
64
+
65
+ BUILDER_CONFIGS = [
66
+ datasets.BuilderConfig(
67
+ name="ubuntu",
68
+ version=VERSION,
69
+ description="This part of the dataset is the annotated conversations from the Ubuntu channel",
70
+ ),
71
+ datasets.BuilderConfig(
72
+ name="channel_two",
73
+ version=VERSION,
74
+ description="This part of the dataset is the annotated conversations from the Channel Two",
75
+ ),
76
+ ]
77
+
78
+ DEFAULT_CONFIG_NAME = "ubuntu"
79
+
80
+ def _info(self):
81
+ if self.config.name == "ubuntu":
82
+ features = datasets.Features(
83
+ {
84
+ "id": datasets.Value("int32"),
85
+ "raw": datasets.Value("string"),
86
+ "ascii": datasets.Value("string"),
87
+ "tokenized": datasets.Value("string"),
88
+ "date": datasets.Value("string"),
89
+ "connections": datasets.features.Sequence(datasets.Value("int32")),
90
+ }
91
+ )
92
+ elif self.config.name == "channel_two":
93
+ features = datasets.Features(
94
+ {
95
+ "id": datasets.Value("int32"),
96
+ "raw": datasets.Value("string"),
97
+ "ascii": datasets.Value("string"),
98
+ "tokenized": datasets.Value("string"),
99
+ "connections": datasets.features.Sequence(datasets.Value("int32")),
100
+ }
101
+ )
102
+ return datasets.DatasetInfo(
103
+ description=_DESCRIPTION,
104
+ features=features,
105
+ supervised_keys=None,
106
+ homepage=_HOMEPAGE,
107
+ license=_LICENSE,
108
+ citation=_CITATION,
109
+ )
110
+
111
+ def _split_generators(self, dl_manager):
112
+ """Returns SplitGenerators."""
113
+ my_urls = _URL
114
+ dl_dir = dl_manager.download_and_extract(my_urls)
115
+
116
+ files = dict()
117
+ if self.config.name == "ubuntu":
118
+ for split in ["train", "dev", "test"]:
119
+ files[split] = os.path.join(dl_dir, "jkkummerfeld-irc-disentanglement-fd379e9", "data", split)
120
+
121
+ return [
122
+ datasets.SplitGenerator(
123
+ name=datasets.Split.TRAIN,
124
+ gen_kwargs={
125
+ "filepath": files["train"],
126
+ "split": "train",
127
+ },
128
+ ),
129
+ datasets.SplitGenerator(
130
+ name=datasets.Split.TEST,
131
+ gen_kwargs={
132
+ "filepath": files["test"],
133
+ "split": "test",
134
+ },
135
+ ),
136
+ datasets.SplitGenerator(
137
+ name=datasets.Split.VALIDATION,
138
+ gen_kwargs={
139
+ "filepath": files["dev"],
140
+ "split": "dev",
141
+ },
142
+ ),
143
+ ]
144
+
145
+ elif self.config.name == "channel_two":
146
+ filepath = os.path.join(dl_dir, "jkkummerfeld-irc-disentanglement-fd379e9", "data", "channel-two")
147
+ return [
148
+ datasets.SplitGenerator(
149
+ name="dev",
150
+ gen_kwargs={
151
+ "filepath": filepath,
152
+ "split": "dev",
153
+ },
154
+ ),
155
+ datasets.SplitGenerator(
156
+ name="pilot",
157
+ gen_kwargs={
158
+ "filepath": filepath,
159
+ "split": "pilot",
160
+ },
161
+ ),
162
+ datasets.SplitGenerator(
163
+ name="test",
164
+ gen_kwargs={
165
+ "filepath": filepath,
166
+ "split": "test",
167
+ },
168
+ ),
169
+ datasets.SplitGenerator(
170
+ name="pilot_dev",
171
+ gen_kwargs={
172
+ "filepath": filepath,
173
+ "split": "pilot-dev",
174
+ },
175
+ ),
176
+ datasets.SplitGenerator(
177
+ name="all_",
178
+ gen_kwargs={
179
+ "filepath": filepath,
180
+ "split": "all",
181
+ },
182
+ ),
183
+ ]
184
+
185
+ def _generate_examples(self, filepath, split):
186
+ """ Yields examples. """
187
+
188
+ if self.config.name == "ubuntu":
189
+ # run loop for each date
190
+ all_files = sorted(glob.glob(os.path.join(filepath, "*.annotation.txt")))
191
+ all_dates = [Path(file).name[:10] for file in all_files]
192
+ all_info = [Path(file).name[10:-15] for file in all_files]
193
+
194
+ elif self.config.name == "channel_two":
195
+ # run loop once (there are no dates for this config)
196
+ all_dates = ["_"]
197
+ all_info = ["_"]
198
+
199
+ last_id = 0
200
+ id_ = 0
201
+
202
+ for date, info in zip(all_dates, all_info):
203
+
204
+ if self.config.name == "ubuntu":
205
+ # load file of given date and additional info for each split
206
+ raw_path = os.path.join(filepath, f"{date}{info}.raw.txt")
207
+ ascii_path = os.path.join(filepath, f"{date}{info}.ascii.txt")
208
+ tok_path = os.path.join(filepath, f"{date}{info}.tok.txt")
209
+ annot_path = os.path.join(filepath, f"{date}{info}.annotation.txt")
210
+
211
+ elif self.config.name == "channel_two":
212
+ # load files of different splits
213
+ raw_path = os.path.join(filepath, f"channel-two.{split}.raw.txt")
214
+ ascii_path = os.path.join(filepath, f"channel-two.{split}.ascii.txt")
215
+ tok_path = os.path.join(filepath, f"channel-two.{split}.tok.txt")
216
+ annot_path = os.path.join(filepath, f"channel-two.{split}.annotation.txt")
217
+
218
+ with open(raw_path, encoding="utf-8") as f_raw, open(ascii_path, encoding="utf-8") as f_ascii, open(
219
+ tok_path, encoding="utf-8"
220
+ ) as f_tok, open(annot_path, encoding="utf-8") as f_annot:
221
+
222
+ # tokenize txt file
223
+ raw_sentences = f_raw.read().split("\n")
224
+ ascii_sentences = f_ascii.read().split("\n")
225
+ tok_sentences = f_tok.read().split("\n")
226
+ annot_lines = f_annot.read().split("\n")
227
+
228
+ assert (
229
+ len(raw_sentences) == len(ascii_sentences) == len(tok_sentences)
230
+ ), "Sizes do not match: %d vs %d vs %d for Raw Sentences vs Ascii Sentences vs Tokenized Sentences." % (
231
+ len(raw_sentences),
232
+ len(ascii_sentences),
233
+ len(tok_sentences),
234
+ )
235
+
236
+ annotation_pairs = []
237
+
238
+ # for annotation lines, make annotation pairs
239
+ for annot in annot_lines:
240
+ line = annot.split(" ")
241
+ if len(line) > 1:
242
+ annotation_pairs.append((int(line[0]), int(line[1])))
243
+
244
+ annotations = dict()
245
+ for row in range(last_id, last_id + len(raw_sentences)):
246
+ annotations[row] = set()
247
+
248
+ for (a, b) in annotation_pairs:
249
+ # required for dummy data creation
250
+ if last_id + a not in annotations:
251
+ annotations[last_id + a] = set()
252
+ if last_id + b not in annotations:
253
+ annotations[last_id + b] = set()
254
+
255
+ # add annotation 'b' to a's annotation set, and vice versa
256
+ annotations[last_id + a].add(last_id + b)
257
+ annotations[last_id + b].add(last_id + a)
258
+
259
+ for i in range(len(raw_sentences)):
260
+ # return all 3 kinds of chat messages, the date (if applicable), and the annotation set for that sentece
261
+ if self.config.name == "ubuntu":
262
+ yield id_, {
263
+ "id": id_,
264
+ "raw": raw_sentences[i],
265
+ "ascii": ascii_sentences[i],
266
+ "tokenized": tok_sentences[i],
267
+ "date": date,
268
+ "connections": sorted(annotations[id_]),
269
+ }
270
+ elif self.config.name == "channel_two":
271
+ yield id_, {
272
+ "id": id_,
273
+ "raw": raw_sentences[i],
274
+ "ascii": ascii_sentences[i],
275
+ "tokenized": tok_sentences[i],
276
+ "connections": sorted(annotations[i]),
277
+ }
278
+ id_ += 1
279
+
280
+ # continue counting from position last left off
281
+ last_id = id_