# coding=utf-8 # """SummScreen dataset.""" import json import datasets _CITATION = """ @inproceedings{chen-etal-2022-summscreen, title = "{S}umm{S}creen: A Dataset for Abstractive Screenplay Summarization", author = "Chen, Mingda and Chu, Zewei and Wiseman, Sam and Gimpel, Kevin", booktitle = "Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)", month = may, year = "2022", address = "Dublin, Ireland", publisher = "Association for Computational Linguistics", url = "https://aclanthology.org/2022.acl-long.589", pages = "8602--8615", abstract = "We introduce SummScreen, a summarization dataset comprised of pairs of TV series transcripts and human written recaps. The dataset provides a challenging testbed for abstractive summarization for several reasons. Plot details are often expressed indirectly in character dialogues and may be scattered across the entirety of the transcript. These details must be found and integrated to form the succinct plot descriptions in the recaps. Also, TV scripts contain content that does not directly pertain to the central plot but rather serves to develop characters or provide comic relief. This information is rarely contained in recaps. Since characters are fundamental to TV series, we also propose two entity-centric evaluation metrics. Empirically, we characterize the dataset by evaluating several methods, including neural models and those based on nearest neighbors. An oracle extractive approach outperforms all benchmarked models according to automatic metrics, showing that the neural models are unable to fully exploit the input transcripts. Human evaluation and qualitative analysis reveal that our non-oracle models are competitive with their oracle counterparts in terms of generating faithful plot events and can benefit from better content selectors. Both oracle and non-oracle models generate unfaithful facts, suggesting future research directions.", } """ _DESCRIPTION = """ SummScreen Corpus contains over 26k pairs of TV series transcripts and human written recaps. There are two features: - dialogue: text of dialogue. - summary: human written summary of the dialogue. - id: id of a example. """ _HOMEPAGE = "https://aclanthology.org/2022.acl-long.589" _SUBSETS = ("all", "fd", "tms") _BASE_DATA_URL = "https://huggingface.co/datasets/yuanpj/summ_screen/resolve/main/data/" _SUBSET_SPLIT_URL = _BASE_DATA_URL + "{subset}_{split}.json" logger = datasets.utils.logging.get_logger(__name__) class SummscreenConfig(datasets.BuilderConfig): """BuilderConfig for SummScreen.""" def __init__(self, name, *args, **kwargs): """BuilderConfig for SummScreen""" super().__init__(name=name, *args, **kwargs) class Summscreen(datasets.GeneratorBasedBuilder): """SummScreen Corpus dataset.""" VERSION = datasets.Version("1.0.0") BUILDER_CONFIGS = [SummscreenConfig(name=subset) for subset in _SUBSETS] def _info(self): features = datasets.Features( { "File Name": datasets.Value("string"), "Recap": datasets.Value("string"), "Transcript": datasets.Value("string"), "Show Title": datasets.Value("string"), "Episode Number": datasets.Value("string"), "Episode Title": datasets.Value("string"), "Recap Author": datasets.Value("string"), "Transcript Author": datasets.Value("string"), } ) # TODO: add license return datasets.DatasetInfo( description=_DESCRIPTION, features=features, supervised_keys=None, homepage=_HOMEPAGE, citation=_CITATION, ) def _split_generators(self, dl_manager): """Returns SplitGenerators.""" splits = ["train", "dev", "test"] subset_split_urls = {split: [] for split in splits} for split in splits: if self.config.name in ["all", "fd"]: subset_split_urls[split].append( _SUBSET_SPLIT_URL.format(subset="fd", split=split) ) if self.config.name in ["all", "tms"]: subset_split_urls[split].append( _SUBSET_SPLIT_URL.format(subset="tms", split=split) ) file_paths = dl_manager.download(subset_split_urls) return [ datasets.SplitGenerator( name=datasets.Split.TRAIN, gen_kwargs={ "file_paths": file_paths["train"], }, ), datasets.SplitGenerator( name=datasets.Split.VALIDATION, gen_kwargs={ "file_paths": file_paths["dev"], }, ), datasets.SplitGenerator( name=datasets.Split.TEST, gen_kwargs={ "file_paths": file_paths["test"], }, ), ] def _generate_examples(self, file_paths): """Yields examples.""" data = [] for file_path in file_paths: with open(file_path, "r", encoding="utf-8") as f: data.extend(json.load(f)) for example in data: yield example["File Name"], example