Datasets:
Tasks:
Summarization
Modalities:
Text
Formats:
json
Languages:
Catalan
Size:
10K - 100K
ArXiv:
License:
onadegibert
commited on
Commit
•
f4a24ba
1
Parent(s):
e6f2294
First init
Browse files- .gitattributes +1 -0
- test.jsonl +3 -0
- vilasum.py +77 -0
.gitattributes
CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
35 |
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
36 |
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.wav filter=lfs diff=lfs merge=lfs -text
|
|
|
|
35 |
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
36 |
*.ogg filter=lfs diff=lfs merge=lfs -text
|
37 |
*.wav filter=lfs diff=lfs merge=lfs -text
|
38 |
+
*.jsonl filter=lfs diff=lfs merge=lfs -text
|
test.jsonl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:be06ecec97fc6c6c52c845dfaa42b6a6e8c8001e805171ea7c1557e98085d3eb
|
3 |
+
size 57089045
|
vilasum.py
ADDED
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Loading script for the VilaSum dataset.
|
2 |
+
import json
|
3 |
+
import datasets
|
4 |
+
|
5 |
+
logger = datasets.logging.get_logger(__name__)
|
6 |
+
|
7 |
+
_CITATION = """
|
8 |
+
|
9 |
+
"""
|
10 |
+
|
11 |
+
_DESCRIPTION = """
|
12 |
+
"""
|
13 |
+
|
14 |
+
_HOMEPAGE = """
|
15 |
+
"""
|
16 |
+
|
17 |
+
#_URL = "https://huggingface.co/datasets/projecte-aina/vilasum/tree/main"
|
18 |
+
_URL = '/home/ona/Documents/Summarization/summ_ca/vilaweb_hf/vilasum/'
|
19 |
+
_TEST_FILE = "test.jsonl"
|
20 |
+
|
21 |
+
class VilaSumConfig(datasets.BuilderConfig):
|
22 |
+
""" Builder config for the VilaSum dataset """
|
23 |
+
|
24 |
+
def __init__(self, **kwargs):
|
25 |
+
"""BuilderConfig for VilaSum.
|
26 |
+
Args:
|
27 |
+
**kwargs: keyword arguments forwarded to super.
|
28 |
+
"""
|
29 |
+
super(VilaSumConfig, self).__init__(**kwargs)
|
30 |
+
|
31 |
+
|
32 |
+
class VilaSum(datasets.GeneratorBasedBuilder):
|
33 |
+
"""VilaSum Dataset."""
|
34 |
+
|
35 |
+
BUILDER_CONFIGS = [
|
36 |
+
VilaSumConfig(
|
37 |
+
name="VilaSum",
|
38 |
+
version=datasets.Version("1.0.0"),
|
39 |
+
description="VilaSum dataset",
|
40 |
+
),
|
41 |
+
]
|
42 |
+
|
43 |
+
def _info(self):
|
44 |
+
return datasets.DatasetInfo(
|
45 |
+
description=_DESCRIPTION,
|
46 |
+
features=datasets.Features(
|
47 |
+
{
|
48 |
+
"summary": datasets.Value("string"),
|
49 |
+
"text": datasets.Value("string"),
|
50 |
+
}
|
51 |
+
|
52 |
+
),
|
53 |
+
supervised_keys=None,
|
54 |
+
homepage=_HOMEPAGE,
|
55 |
+
citation=_CITATION,
|
56 |
+
)
|
57 |
+
|
58 |
+
def _split_generators(self, dl_manager):
|
59 |
+
"""Returns SplitGenerators."""
|
60 |
+
urls_to_download = {
|
61 |
+
"test": f"{_URL}{_TEST_FILE}"
|
62 |
+
}
|
63 |
+
downloaded_files = dl_manager.download_and_extract(urls_to_download)
|
64 |
+
|
65 |
+
return [
|
66 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": downloaded_files["test"]}),
|
67 |
+
]
|
68 |
+
|
69 |
+
def _generate_examples(self, filepath):
|
70 |
+
"""This function returns the examples in the raw (text) form."""
|
71 |
+
logger.info("generating examples from = %s", filepath)
|
72 |
+
with open(filepath, encoding="utf-8") as f:
|
73 |
+
for id_, row in enumerate(f):
|
74 |
+
article = json.loads(row)
|
75 |
+
text = article['text']
|
76 |
+
summary = article['summary']
|
77 |
+
yield id_, { "summary": summary,"text": text}
|