w-nicole commited on
Commit
603559f
1 Parent(s): 887501c

childes dataset, no tags

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