w-nicole commited on
Commit
d38a0ff
1 Parent(s): 3c683b7

remade the childes with tags

Browse files
childes_data_with_tags_.py ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # The majority of this file was taken and adapted from this file, on 6/3/21: https://github.com/huggingface/datasets/blob/master/datasets/snli/snli.py
2
+
3
+
4
+ # License reproduced from the original code:
5
+
6
+ # coding=utf-8
7
+ # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+
21
+
22
+ # The changes to the file include:
23
+ # Changing all of the parameters to reflect childes data and information
24
+ # Changing the dl_manager to be essentially unused in split_generators and loading from text files instead
25
+ # Changing generate_examples to load directly from text files and clean the lines of text.
26
+
27
+
28
+ import datasets
29
+ import os
30
+
31
+ class Childes(datasets.GeneratorBasedBuilder):
32
+
33
+ BUILDER_CONFIGS = [
34
+ datasets.BuilderConfig(
35
+ name="childes_data_with_tags_",
36
+ version=datasets.Version("1.0.0", ""),
37
+ description="Childes language modeling dataset with speaker tags.",
38
+ )
39
+ ]
40
+
41
+
42
+
43
+ def _info(self):
44
+
45
+ citation_text = """\\
46
+ @article{sanchez2019childes,
47
+ title={childes-db: A flexible and reproducible interface to the child language data exchange system},
48
+ author={Sanchez, Alessandro and Meylan, Stephan C and Braginsky, Mika and MacDonald, Kyle E and Yurovsky, Daniel and Frank, Michael C},
49
+ journal={Behavior research methods},
50
+ volume={51},
51
+ number={4},
52
+ pages={1928--1941},
53
+ year={2019},
54
+ publisher={Springer}}
55
+ """
56
+
57
+
58
+ return datasets.DatasetInfo(
59
+ description = "CHILDES data for language modeling",
60
+ citation = citation_text,
61
+ # 6/3 Citation info is directly taken from Google Scholar
62
+ features=datasets.Features(
63
+ {
64
+ "text": datasets.Value("string"),
65
+ }
66
+ ),
67
+ # No default supervised_keys (as we have to pass both premise
68
+ # and hypothesis as input).
69
+ homepage="https://childes-db.stanford.edu/",
70
+ )
71
+
72
+
73
+ def _split_generators(self, download_helper):
74
+
75
+ paths = download_helper.download_and_extract({
76
+ 'train' : 'https://www.dropbox.com/s/dl/i282barrzlari08/train.txt?dl=1',
77
+ 'val' : 'https://www.dropbox.com/s/gx0rngo3v5mvlcf/validation.txt?dl=1',
78
+ })
79
+
80
+ list_datasets = []
81
+
82
+ phases = ['train', 'val']
83
+ dataset_names = [
84
+ datasets.Split.TRAIN,
85
+ datasets.Split.VALIDATION,
86
+ ]
87
+
88
+ for phase, phase_name in zip(phases, dataset_names):
89
+
90
+ this_dataset = datasets.SplitGenerator(
91
+ name=phase_name, gen_kwargs={"file_path": paths[phase]}
92
+ )
93
+
94
+ list_datasets.append(this_dataset)
95
+
96
+
97
+ return list_datasets
98
+
99
+ def _generate_examples(self, file_path):
100
+
101
+ # 6/17: https://stackoverflow.com/questions/10406135/unicodedecodeerror-ascii-codec-cant-decode-byte-0xd1-in-position-2-ordinal
102
+ with open(file_path, 'r', encoding="utf-8") as f:
103
+ for idx, line in enumerate(f.readlines()):
104
+ yield idx, {"text" : line.strip('\n')}
105
+
106
+
107
+
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"childes_data_with_tags_": {"description": "CHILDES data for language modeling", "citation": "\\\n@article{sanchez2019childes,\n title={childes-db: A flexible and reproducible interface to the child language data exchange system},\n author={Sanchez, Alessandro and Meylan, Stephan C and Braginsky, Mika and MacDonald, Kyle E and Yurovsky, Daniel and Frank, Michael C},\n journal={Behavior research methods},\n volume={51},\n number={4},\n pages={1928--1941},\n year={2019},\n publisher={Springer}}\n ", "homepage": "https://childes-db.stanford.edu/", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "childes", "config_name": "childes_data_with_tags_", "version": {"version_str": "1.0.0", "description": "", "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 90694611, "num_examples": 3204912, "dataset_name": "childes"}, "validation": {"name": "validation", "num_bytes": 20274372, "num_examples": 721622, "dataset_name": "childes"}}, "download_checksums": {"https://www.dropbox.com/s/dl/i282barrzlari08/train.txt?dl=1": {"num_bytes": 81078591, "checksum": "be22b32ff345d0a63ae17f37329a52a62945658e2b5bb482c56a23a192c9b1ea"}, "https://www.dropbox.com/s/gx0rngo3v5mvlcf/validation.txt?dl=1": {"num_bytes": 18109214, "checksum": "e34be62bb2bdd8913935aeef963ccbf7da78a1ecf44bbdfeb69dbe2146a91155"}}, "download_size": 99187805, "post_processing_size": null, "dataset_size": 110968983, "size_in_bytes": 210156788}}
dummy/childes_data_with_tags_/1.0.0/dummy_data.zip ADDED
Binary file (740 Bytes). View file
 
dummy/childes_data_with_tags_/1.0.0/dummy_data.zip.lock ADDED
File without changes