albertvillanova HF staff commited on
Commit
f6cfa2c
1 Parent(s): cc00451

Convert dataset to Parquet (#5)

Browse files

- Convert dataset to Parquet (da2a66149af8ee5ae98f2ec7a0d8ae1c5e036731)
- Add 'channel_two' config data files (657e12a670191ae246d086b948759c0bb29d24c6)
- Delete loading script (e87ccdd117d4f12d8f09fddd8960c0f15c34ba8a)

README.md CHANGED
@@ -21,7 +21,7 @@ pretty_name: IRC Disentanglement
21
  tags:
22
  - conversation-disentanglement
23
  dataset_info:
24
- - config_name: ubuntu
25
  features:
26
  - name: id
27
  dtype: int32
@@ -31,23 +31,27 @@ dataset_info:
31
  dtype: string
32
  - name: tokenized
33
  dtype: string
34
- - name: date
35
- dtype: string
36
  - name: connections
37
  sequence: int32
38
  splits:
39
- - name: train
40
- num_bytes: 56012854
41
- num_examples: 220616
42
- - name: validation
43
- num_bytes: 3081479
44
- num_examples: 12510
45
  - name: test
46
- num_bytes: 3919900
47
- num_examples: 15010
48
- download_size: 118470210
49
- dataset_size: 63014233
50
- - config_name: channel_two
 
 
 
 
 
 
51
  features:
52
  - name: id
53
  dtype: int32
@@ -57,26 +61,44 @@ dataset_info:
57
  dtype: string
58
  - name: tokenized
59
  dtype: string
 
 
60
  - name: connections
61
  sequence: int32
62
  splits:
63
- - name: dev
64
- num_bytes: 197505
65
- num_examples: 1001
66
- - name: pilot
67
- num_bytes: 92663
68
- num_examples: 501
69
  - name: test
70
- num_bytes: 186823
71
- num_examples: 1001
72
- - name: pilot_dev
73
- num_bytes: 290175
74
- num_examples: 1501
75
- - name: all_
76
- num_bytes: 496524
77
- num_examples: 2602
78
- download_size: 118470210
79
- dataset_size: 1263690
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  ---
81
 
82
 
 
21
  tags:
22
  - conversation-disentanglement
23
  dataset_info:
24
+ - config_name: channel_two
25
  features:
26
  - name: id
27
  dtype: int32
 
31
  dtype: string
32
  - name: tokenized
33
  dtype: string
 
 
34
  - name: connections
35
  sequence: int32
36
  splits:
37
+ - name: dev
38
+ num_bytes: 197173
39
+ num_examples: 1001
40
+ - name: pilot
41
+ num_bytes: 92498
42
+ num_examples: 501
43
  - name: test
44
+ num_bytes: 186478
45
+ num_examples: 1001
46
+ - name: pilot_dev
47
+ num_bytes: 289679
48
+ num_examples: 1501
49
+ - name: all_
50
+ num_bytes: 495650
51
+ num_examples: 2602
52
+ download_size: 715946
53
+ dataset_size: 1261478
54
+ - config_name: ubuntu
55
  features:
56
  - name: id
57
  dtype: int32
 
61
  dtype: string
62
  - name: tokenized
63
  dtype: string
64
+ - name: date
65
+ dtype: string
66
  - name: connections
67
  sequence: int32
68
  splits:
69
+ - name: train
70
+ num_bytes: 55970012
71
+ num_examples: 220616
72
+ - name: validation
73
+ num_bytes: 3079320
74
+ num_examples: 12510
75
  - name: test
76
+ num_bytes: 3916841
77
+ num_examples: 15010
78
+ download_size: 33214005
79
+ dataset_size: 62966173
80
+ configs:
81
+ - config_name: channel_two
82
+ data_files:
83
+ - split: dev
84
+ path: channel_two/dev-*
85
+ - split: pilot
86
+ path: channel_two/pilot-*
87
+ - split: test
88
+ path: channel_two/test-*
89
+ - split: pilot_dev
90
+ path: channel_two/pilot_dev-*
91
+ - split: all_
92
+ path: channel_two/all_-*
93
+ - config_name: ubuntu
94
+ data_files:
95
+ - split: train
96
+ path: ubuntu/train-*
97
+ - split: validation
98
+ path: ubuntu/validation-*
99
+ - split: test
100
+ path: ubuntu/test-*
101
+ default: true
102
  ---
103
 
104
 
channel_two/all_-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acac7a02cc3fe4fa7f8e14da48c88257422182dc1a10c248f13194bda6d813f1
3
+ size 279315
channel_two/dev-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b5d9801fd53eb530b5e2e04cbfd05f916f0801a949250109acdc95409f2a8e7f
3
+ size 109403
channel_two/pilot-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4b1a53149116d939384b372a4506c38a7b17da82082e96d4dea4a08daa82e929
3
+ size 55912
channel_two/pilot_dev-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f1b2b0356a52dffb8abe2fd864e7ef2aeae03e0462cd97d2b434a3a0bb6020e
3
+ size 161875
channel_two/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b74b04a577d4974a09c879a1b9c50f0434d857155d7aa9d59e94d0ba6fa5efd3
3
+ size 109441
irc_disentangle.py DELETED
@@ -1,272 +0,0 @@
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
-
18
- import glob
19
- import os
20
- from pathlib import Path
21
-
22
- import datasets
23
-
24
-
25
- _CITATION = """\
26
- @inproceedings{kummerfeld-etal-2019-large,
27
- title = "A Large-Scale Corpus for Conversation Disentanglement",
28
- author = "Kummerfeld, Jonathan K. and
29
- Gouravajhala, Sai R. and
30
- Peper, Joseph J. and
31
- Athreya, Vignesh and
32
- Gunasekara, Chulaka and
33
- Ganhotra, Jatin and
34
- Patel, Siva Sankalp and
35
- Polymenakos, Lazaros C and
36
- Lasecki, Walter",
37
- booktitle = "Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics",
38
- month = jul,
39
- year = "2019",
40
- address = "Florence, Italy",
41
- publisher = "Association for Computational Linguistics",
42
- url = "https://aclanthology.org/P19-1374",
43
- doi = "10.18653/v1/P19-1374",
44
- pages = "3846--3856",
45
- arxiv = "https://arxiv.org/abs/1810.11118",
46
- software = "https://jkk.name/irc-disentanglement",
47
- data = "https://jkk.name/irc-disentanglement",
48
- abstract = "Disentangling conversations mixed together in a single stream of messages is a difficult task, made harder by the lack of large manually annotated datasets. We created a new dataset of 77,563 messages manually annotated with reply-structure graphs that both disentangle conversations and define internal conversation structure. Our data is 16 times larger than all previously released datasets combined, the first to include adjudication of annotation disagreements, and the first to include context. We use our data to re-examine prior work, in particular, finding that 89% of conversations in a widely used dialogue corpus are either missing messages or contain extra messages. Our manually-annotated data presents an opportunity to develop robust data-driven methods for conversation disentanglement, which will help advance dialogue research.",
49
- }
50
- """
51
-
52
- _DESCRIPTION = """\
53
- Disentangling conversations mixed together in a single stream of messages is
54
- a difficult task, made harder by the lack of large manually annotated
55
- datasets. This new dataset of 77,563 messages manually annotated with
56
- reply-structure graphs that both disentangle conversations and define
57
- internal conversation structure. The dataset is 16 times larger than all
58
- previously released datasets combined, the first to include adjudication of
59
- annotation disagreements, and the first to include context.
60
- """
61
-
62
- _HOMEPAGE = "https://jkk.name/irc-disentanglement/"
63
-
64
- _LICENSE = "Creative Commons Attribution 4.0 International Public License"
65
-
66
- _URL = "https://github.com/jkkummerfeld/irc-disentanglement/archive/refs/heads/master.zip"
67
-
68
-
69
- class IRCDisentangle(datasets.GeneratorBasedBuilder):
70
- """IRCDisentangle dataset"""
71
-
72
- VERSION = datasets.Version("1.0.0")
73
-
74
- BUILDER_CONFIGS = [
75
- datasets.BuilderConfig(
76
- name="ubuntu",
77
- version=VERSION,
78
- description="This part of the dataset is the annotated conversations from the Ubuntu channel",
79
- ),
80
- datasets.BuilderConfig(
81
- name="channel_two",
82
- version=VERSION,
83
- description="This part of the dataset is the annotated conversations from the Channel Two",
84
- ),
85
- ]
86
-
87
- DEFAULT_CONFIG_NAME = "ubuntu"
88
-
89
- def _info(self):
90
- if self.config.name == "ubuntu":
91
- features = datasets.Features(
92
- {
93
- "id": datasets.Value("int32"),
94
- "raw": datasets.Value("string"),
95
- "ascii": datasets.Value("string"),
96
- "tokenized": datasets.Value("string"),
97
- "date": datasets.Value("string"),
98
- "connections": datasets.features.Sequence(datasets.Value("int32")),
99
- }
100
- )
101
- elif self.config.name == "channel_two":
102
- features = datasets.Features(
103
- {
104
- "id": datasets.Value("int32"),
105
- "raw": datasets.Value("string"),
106
- "ascii": datasets.Value("string"),
107
- "tokenized": datasets.Value("string"),
108
- "connections": datasets.features.Sequence(datasets.Value("int32")),
109
- }
110
- )
111
- return datasets.DatasetInfo(
112
- description=_DESCRIPTION,
113
- features=features,
114
- supervised_keys=None,
115
- homepage=_HOMEPAGE,
116
- license=_LICENSE,
117
- citation=_CITATION,
118
- )
119
-
120
- def _split_generators(self, dl_manager):
121
- """Returns SplitGenerators."""
122
- dl_dir = dl_manager.download_and_extract(_URL)
123
- filepath = os.path.join(dl_dir, "irc-disentanglement-master", "data")
124
- split_names = {datasets.Split.TRAIN: "train", datasets.Split.VALIDATION: "dev", datasets.Split.TEST: "test"}
125
- if self.config.name == "ubuntu":
126
- return [
127
- datasets.SplitGenerator(
128
- name=split,
129
- gen_kwargs={
130
- "filepath": os.path.join(filepath, split_name),
131
- "split": split_name,
132
- },
133
- )
134
- for split, split_name in split_names.items()
135
- ]
136
- elif self.config.name == "channel_two":
137
- filepath = os.path.join(filepath, "channel-two")
138
- return [
139
- datasets.SplitGenerator(
140
- name="dev",
141
- gen_kwargs={
142
- "filepath": filepath,
143
- "split": "dev",
144
- },
145
- ),
146
- datasets.SplitGenerator(
147
- name="pilot",
148
- gen_kwargs={
149
- "filepath": filepath,
150
- "split": "pilot",
151
- },
152
- ),
153
- datasets.SplitGenerator(
154
- name="test",
155
- gen_kwargs={
156
- "filepath": filepath,
157
- "split": "test",
158
- },
159
- ),
160
- datasets.SplitGenerator(
161
- name="pilot_dev",
162
- gen_kwargs={
163
- "filepath": filepath,
164
- "split": "pilot-dev",
165
- },
166
- ),
167
- datasets.SplitGenerator(
168
- name="all_",
169
- gen_kwargs={
170
- "filepath": filepath,
171
- "split": "all",
172
- },
173
- ),
174
- ]
175
-
176
- def _generate_examples(self, filepath, split):
177
- """Yields examples."""
178
-
179
- if self.config.name == "ubuntu":
180
- # run loop for each date
181
- all_files = sorted(glob.glob(os.path.join(filepath, "*.annotation.txt")))
182
- all_dates = [Path(filename).name[:10] for filename in all_files]
183
- all_info = [Path(filename).name[10:-15] for filename in all_files]
184
-
185
- elif self.config.name == "channel_two":
186
- # run loop once (there are no dates for this config)
187
- all_dates = ["_"]
188
- all_info = ["_"]
189
-
190
- last_id = 0
191
- id_ = 0
192
-
193
- for date, info in zip(all_dates, all_info):
194
-
195
- if self.config.name == "ubuntu":
196
- # load file of given date and additional info for each split
197
- raw_path = os.path.join(filepath, f"{date}{info}.raw.txt")
198
- ascii_path = os.path.join(filepath, f"{date}{info}.ascii.txt")
199
- tok_path = os.path.join(filepath, f"{date}{info}.tok.txt")
200
- annot_path = os.path.join(filepath, f"{date}{info}.annotation.txt")
201
-
202
- elif self.config.name == "channel_two":
203
- # load files of different splits
204
- raw_path = os.path.join(filepath, f"channel-two.{split}.raw.txt")
205
- ascii_path = os.path.join(filepath, f"channel-two.{split}.ascii.txt")
206
- tok_path = os.path.join(filepath, f"channel-two.{split}.tok.txt")
207
- annot_path = os.path.join(filepath, f"channel-two.{split}.annotation.txt")
208
-
209
- with open(raw_path, encoding="utf-8") as f_raw, open(ascii_path, encoding="utf-8") as f_ascii, open(
210
- tok_path, encoding="utf-8"
211
- ) as f_tok, open(annot_path, encoding="utf-8") as f_annot:
212
-
213
- # tokenize txt file
214
- raw_sentences = f_raw.read().split("\n")
215
- ascii_sentences = f_ascii.read().split("\n")
216
- tok_sentences = f_tok.read().split("\n")
217
- annot_lines = f_annot.read().split("\n")
218
-
219
- assert (
220
- len(raw_sentences) == len(ascii_sentences) == len(tok_sentences)
221
- ), "Sizes do not match: %d vs %d vs %d for Raw Sentences vs Ascii Sentences vs Tokenized Sentences." % (
222
- len(raw_sentences),
223
- len(ascii_sentences),
224
- len(tok_sentences),
225
- )
226
-
227
- annotation_pairs = []
228
-
229
- # for annotation lines, make annotation pairs
230
- for annot in annot_lines:
231
- line = annot.split(" ")
232
- if len(line) > 1:
233
- annotation_pairs.append((int(line[0]), int(line[1])))
234
-
235
- annotations = dict()
236
- for row in range(last_id, last_id + len(raw_sentences)):
237
- annotations[row] = set()
238
-
239
- for (a, b) in annotation_pairs:
240
- # required for dummy data creation
241
- if last_id + a not in annotations:
242
- annotations[last_id + a] = set()
243
- if last_id + b not in annotations:
244
- annotations[last_id + b] = set()
245
-
246
- # add annotation 'b' to a's annotation set, and vice versa
247
- annotations[last_id + a].add(last_id + b)
248
- annotations[last_id + b].add(last_id + a)
249
-
250
- for i in range(len(raw_sentences)):
251
- # return all 3 kinds of chat messages, the date (if applicable), and the annotation set for that sentece
252
- if self.config.name == "ubuntu":
253
- yield id_, {
254
- "id": id_,
255
- "raw": raw_sentences[i],
256
- "ascii": ascii_sentences[i],
257
- "tokenized": tok_sentences[i],
258
- "date": date,
259
- "connections": sorted(annotations[id_]),
260
- }
261
- elif self.config.name == "channel_two":
262
- yield id_, {
263
- "id": id_,
264
- "raw": raw_sentences[i],
265
- "ascii": ascii_sentences[i],
266
- "tokenized": tok_sentences[i],
267
- "connections": sorted(annotations[i]),
268
- }
269
- id_ += 1
270
-
271
- # continue counting from position last left off
272
- last_id = id_
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ubuntu/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a6a3a4dec7f1cfe05fd47a5b00ec5969cff5a53e33f3120a3b5d522ed3e88c83
3
+ size 2116104
ubuntu/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7ef4cc537e2c88d3202e2404b7dc76df177856a94d6edaedd89b418ab896d52
3
+ size 29452339
ubuntu/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a5aeada72085ce29c5f24127918bc9255665f3be0a5112568d504be903741d80
3
+ size 1645562