CNLeonardoCordoba commited on
Commit
5071ee1
1 Parent(s): 2c277b9
Files changed (5) hide show
  1. CC-NEWS-ES-titles.py +92 -0
  2. eval.json +2 -2
  3. sample.json +3 -0
  4. test.json +2 -2
  5. train.json +2 -2
CC-NEWS-ES-titles.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ # coding=utf-8
3
+ # Copyright 2020 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Lint as: python3
18
+ """CC-NEWS-ES-titles: Title generation from CC-NEWS in Spanish."""
19
+
20
+
21
+ import json
22
+
23
+ import datasets
24
+ from datasets.tasks import Summarization
25
+
26
+
27
+ logger = datasets.logging.get_logger(__name__)
28
+
29
+
30
+ _CITATION = """ """
31
+ _DESCRIPTION = ""
32
+ _HOMEPAGE = ""
33
+
34
+ _LICENSE = ""
35
+
36
+ _URL = "https://huggingface.co/datasets/LeoCordoba/CC-NEWS-ES-titles/"
37
+ _URLS = {
38
+ "train": _URL + "blob/main/train.json",
39
+ "test": _URL + "blob/main/test.json",
40
+ "eval": _URL + "blob/main/eval.json",
41
+ }
42
+
43
+ class CCNewsESTitlesConfig(datasets.BuilderConfig):
44
+ """BuilderConfig for CCNewsESTitles."""
45
+
46
+ def __init__(self, **kwargs):
47
+ """BuilderConfig for CCNewsESTitles.
48
+ Args:
49
+ **kwargs: keyword arguments forwarded to super.
50
+ """
51
+ super(CCNewsESTitlesConfig, self).__init__(**kwargs)
52
+
53
+ class CCNewsESTitles(datasets.GeneratorBasedBuilder):
54
+ """Title generation dataset in Spanish from CC-NEWS"""
55
+ VERSION = datasets.Version("1.0.0")
56
+
57
+ BUILDER_CONFIGS = [
58
+ CCNewsESTitlesConfig(
59
+ ),
60
+ ]
61
+
62
+ def _info(self):
63
+ return datasets.DatasetInfo(
64
+ description=_DESCRIPTION,
65
+ features=datasets.Features(
66
+ {
67
+ "text": datasets.Value("string"),
68
+ "output_test": datasets.Value("string")
69
+ }
70
+ ),
71
+ homepage=_HOMEPAGE,
72
+ license=_LICENSE,
73
+ citation=_CITATION,
74
+ )
75
+ def _split_generators(self, dl_manager):
76
+ """Returns SplitGenerators."""
77
+ downloaded_files = dl_manager.download_and_extract(_URLS)
78
+
79
+ return [
80
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),
81
+ datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": downloaded_files["eval"]}),
82
+ datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]})
83
+ ]
84
+ def _generate_examples(self, filepath):
85
+ """This function returns the examples in the raw (text) form."""
86
+ logger.info("generating examples from = %s", filepath)
87
+ data = []
88
+ with open(filepath, encoding="utf-8") as f:
89
+ for line in f:
90
+ data.append(json.loads(line))
91
+ for obs in data:
92
+ yield(obs)
eval.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b830af8eb15f7fdae97cc27970f61567b4cc1267adbce0217cab0187485560f5
3
- size 28194082
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d2e986d4a36a8194915e8e4e35e5723324f3df9494f223ee5a7f341cc4e98f36
3
+ size 26167193
sample.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:17cf1031cc688e9e93848523882cc7c745fe5a812b802f7dca5f462822bc5ff6
3
+ size 7594
test.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a9c3105a6a4331114890195508163a3e354e990089a516e967eb7e5350413dd1
3
- size 28313093
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e46ea032c13a268fd2346e728ea1b1f919b6f8af50712b5c38c9fda83c26f3d9
3
+ size 26285538
train.json CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:33c2194ae8709573d0067b89de62195a4f733f132ae9a87a54eb90b666bed648
3
- size 648665816
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8fb35cda6132005a9862bd658093bdd5f2100e1cf729ac38fce31fa23d9774f
3
+ size 602204733