aaronmueller commited on
Commit ·
91a19aa
1
Parent(s): 2d273b1
v1.0
Browse filesFiles changed (2)
- README.mdAdded+146
- syntactic_transformations.pyAdded+203
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146---annotations_creators:- no-annotationlanguage_creators:- foundlanguages:- en,delicenses:- MITmultilinguality:- 2 languagessize_categories:- 100K<n<1Msource_datasets:- originaltask_categories:- syntactic-evaluationtask_ids:- syntactic-transformations---
# Dataset Card for syntactic_transformations
## Table of Contents- [Dataset Description](#dataset-description) - [Dataset Summary](#dataset-summary) - [Supported Tasks](#supported-tasks-and-leaderboards) - [Languages](#languages)- [Dataset Structure](#dataset-structure) - [Data Instances](#data-instances) - [Data Fields](#data-instances) - [Data Splits](#data-instances)- [Dataset Creation](#dataset-creation) - [Curation Rationale](#curation-rationale) - [Source Data](#source-data) - [Annotations](#annotations) - [Personal and Sensitive Information](#personal-and-sensitive-information)- [Considerations for Using the Data](#considerations-for-using-the-data) - [Social Impact of Dataset](#social-impact-of-dataset) - [Discussion of Biases](#discussion-of-biases) - [Other Known Limitations](#other-known-limitations)- [Additional Information](#additional-information) - [Dataset Curators](#dataset-curators) - [Licensing Information](#licensing-information) - [Citation Information](#citation-information)
## Dataset Description
- **Homepage:** [Needs More Information]- **Repository:** https://github.com/sebschu/multilingual-transformations- **Paper:** [Coloring the Blank Slate: Pre-training Imparts a Hierarchical Inductive Bias to Sequence-to-sequence Models](https://aclanthology.org/2022.findings-acl.106/)- **Leaderboard:** [Needs More Information]- **Point of Contact:** [Aaron Mueller](mailto:amueller@jhu.edu)
### Dataset Summary
This contains the the syntactic transformations datasets used in [Coloring the Blank Slate: Pre-training Imparts a Hierarchical Inductive Bias to Sequence-to-sequence Models](https://aclanthology.org/2022.findings-acl.106/). It consists of English and German question formation and passivization transformations. This dataset also contains zero-shot cross-lingual transfer training and evaluation data.
### Supported Tasks and Leaderboards
[Needs More Information]
### Languages
English and German.
## Dataset Structure
### Data Instances
A typical data point consists of a source sequence ("src"), a target sequence ("tgt"), and a task prefix ("prefix"). The prefix indicates whether a given sequence should be kept the same in the target (indicated by the "decl:" prefix) or transformed into a question/passive ("quest:"/"passiv:", respectively). An example follows:
{"src": "the yak has entertained the walruses that have amused the newt.","tgt": "has the yak entertained the walruses that have amused the newt?","prefix": "quest: "}
### Data Fields
- src: the original source sequence.- tgt: the transformed target sequence.- prefix: indicates which transformation to perform to map from the source to target sequences.
### Data Splits
The datasets are split into training, dev, test, and gen ("generalization") sets. The training sets are for fine-tuning the model. The dev and test sets are for evaluating model abilities on in-domain transformations. The generalization sets are for evaluating the inductive biases of the model.
NOTE: for the zero-shot cross-lingual transfer datasets, the generalization sets are split into in-domain and out-of-domain syntactic structures. For in-domain transformations, use "gen_rc_o" for question formation or "gen_pp_o" for passivization. For out-of-domain transformations, use "gen_rc_s" for question formation or "gen_pp_s" for passivization.
## Dataset Creation
### Curation Rationale
[Needs More Information]
### Source Data
#### Initial Data Collection and Normalization
[Needs More Information]
#### Who are the source language producers?
[Needs More Information]
### Annotations
#### Annotation process
[Needs More Information]
#### Who are the annotators?
[Needs More Information]
### Personal and Sensitive Information
[Needs More Information]
## Considerations for Using the Data
### Social Impact of Dataset
[Needs More Information]
### Discussion of Biases
[Needs More Information]
### Other Known Limitations
[Needs More Information]
## Additional Information
### Dataset Curators
[Needs More Information]
### Licensing Information
[Needs More Information]
### Citation Information
[Needs More Information]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203import dataclassesimport datasetsimport json
logger = datasets.logging.get_logger(__name__)
_CITATION = """\@inproceedings{mueller-etal-2022-coloring, title = "Coloring the Blank Slate: Pre-training Imparts a Hierarchical Inductive Bias to Sequence-to-sequence Models", author = "Mueller, Aaron and Frank, Robert and Linzen, Tal and Wang, Luheng and Schuster, Sebastian", booktitle = "Findings of the Association for Computational Linguistics: ACL 2022", month = may, year = "2022", address = "Dublin, Ireland", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2022.findings-acl.106", doi = "10.18653/v1/2022.findings-acl.106", pages = "1352--1368",}"""
_DESCRIPTION = """\This is the dataset used for Coloring the Blank Slate: Pre-training Imparts a Hierarchical Inductive Bias toSequence-to-sequence Models."""
class SyntacticTransformationsConfig(datasets.BuilderConfig): def __init__(self, description, features, data_url, citation, url, **kwargs): super(SyntacticTransformationsConfig, self).__init__(version=datasets.Version("1.18.3"), **kwargs) self.description = description self.text_features = features self.citation = citation self.data_url = data_url self.url = url
class SyntacticTransformations(datasets.GeneratorBasedBuilder): standard_features = datasets.Features( { "src": datasets.Value("string"), "tgt": datasets.Value("string"), "prefix": datasets.Value("string") } ) BUILDER_CONFIGS = [ SyntacticTransformationsConfig( name="passiv-en-nps", description="English passivization transformations.", features=standard_features, data_url="https://raw.githubusercontent.com/sebschu/multilingual-transformations/main/data/passiv_en_nps/", url="https://github.com/sebschu/multilingual-transformations/", citation=_CITATION ), SyntacticTransformationsConfig( name="passiv-de-nps", description="German passivization transformations.", features=standard_features, data_url="https://raw.githubusercontent.com/sebschu/multilingual-transformations/main/data/passiv_de_nps/", url="https://github.com/sebschu/multilingual-transformations/", citation=_CITATION ), SyntacticTransformationsConfig( name="question-en", description="English question formation transformations.", features=standard_features, data_url="https://raw.githubusercontent.com/sebschu/multilingual-transformations/main/data/question_have-havent_en/", url="https://github.com/sebschu/multilingual-transformations/", citation=_CITATION ), SyntacticTransformationsConfig( name="question-de", description="German question formation transformations.", features=standard_features, data_url="https://raw.githubusercontent.com/sebschu/multilingual-transformations/main/data/question_have-can_withquest_de/", url="https://github.com/sebschu/multilingual-transformations/", citation=_CITATION ), SyntacticTransformationsConfig( name="passiv-en_de-nps", description="Zero-shot English-to-German passivization transformations.", features=standard_features, data_url="https://raw.githubusercontent.com/sebschu/multilingual-transformations/main/data/passiv_en-de_nps/", url="https://github.com/sebschu/multilingual-transformations/", citation=_CITATION ), SyntacticTransformationsConfig( name="question-en_de", description="Zero-shot English-to-German question formation transformations.", features=standard_features, data_url="https://raw.githubusercontent.com/sebschu/multilingual-transformations/main/data/question_have-can_de/", url="https://github.com/sebschu/multilingual-transformations/", citation=_CITATION ) ] def _split_generators(self, dl_manager): if self.config.name == "passiv-en-nps": template = "passiv_en_nps.{}.json" _URLS = { "train": self.config.data_url + template.format("train"), "dev": self.config.data_url + template.format("dev"), "test": self.config.data_url + template.format("test"), "gen": self.config.data_url + template.format("gen"), } elif self.config.name == "passiv-de-nps": template = "passiv_de_nps.{}.json" _URLS = { "train": self.config.data_url + template.format("train"), "dev": self.config.data_url + template.format("dev"), "test": self.config.data_url + template.format("test"), "gen": self.config.data_url + template.format("gen"), } elif self.config.name == "question-en": template = "question_have.{}.json" _URLS = { "train": self.config.data_url + template.format("train"), "dev": self.config.data_url + template.format("dev"), "test": self.config.data_url + template.format("test"), "gen": self.config.data_url + template.format("gen"), } elif self.config.name == "question-de": template = "question_have_can.de.{}.json" _URLS = { "train": self.config.data_url + template.format("train"), "dev": self.config.data_url + template.format("dev"), "test": self.config.data_url + template.format("test"), "gen": self.config.data_url + template.format("gen"), } elif self.config.name == "question-en_de": template = "question_have_can.de.{}.json" _URLS = { "train": self.config.data_url + "question_have_can.en-de.train.json", "dev": self.config.data_url + template.format("dev"), "test": self.config.data_url + template.format("test"), "gen_rc_s": self.config.data_url + template.format("gen_rc_s"), "gen_rc_o": self.config.data_url + template.format("gen_rc_o"), } elif self.config.name == "passiv-en_de-nps": template = "passiv_de_nps.{}.json" _URLS = { "train": self.config.data_url + "passiv_en-de_nps.train.json", "dev": self.config.data_url + template.format("dev"), "test": self.config.data_url + template.format("test"), "gen_pp_s": self.config.data_url + template.format("gen_pp_s"), "gen_pp_o": self.config.data_url + template.format("gen_pp_o"), }
data_files = dl_manager.download(_URLS)
if "en_de" not in self.config.name: return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_files["train"]}), datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}), datasets.SplitGenerator(name=datasets.NamedSplit('generalization'), gen_kwargs={"filepath": data_files["gen"]}), ] else: gen_s = "gen_pp_s" if "passiv" in self.config.name else "gen_rc_s" gen_o = "gen_pp_o" if "passiv" in self.config.name else "gen_rc_o" return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_files["train"]}), datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}), datasets.SplitGenerator(name=datasets.NamedSplit('generalization_s'), gen_kwargs={"filepath": data_files[gen_s]}), datasets.SplitGenerator(name=datasets.NamedSplit('generalization_o'), gen_kwargs={"filepath": data_files[gen_o]}), ]
def _info(self): features = {text_feature: datasets.Value("string") for text_feature in self.config.text_features.keys()} return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features(features), homepage=self.config.url, citation=_CITATION, ) def _generate_examples(self, filepath): """This function returns the examples in the raw (text) form.""" logger.info("generating examples from = %s", filepath) with open(filepath) as f: id_ = 0 for line in f: example = json.loads(line) src = example["translation"]["src"] tgt = example["translation"]["tgt"] prefix = example["translation"]["prefix"]
# Features currently used are "context", "question", and "answers". # Others are extracted here for the ease of future expansions. yield id_, { "src": src, "tgt": tgt, "prefix": prefix, } id_ += 1README.mdAdded+146
syntactic_transformations.pyAdded+203