Datasets:
cjvt
/

Languages:
Slovenian
Size:
n<1K
License:
File size: 3,563 Bytes
7a5d175
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import csv
import json
import os

import datasets


_CITATION = """\
 @misc{11356/1682,
 title = {Slovene text simplification dataset {SloTS}},
 author = {Gorenc, Sabina and Robnik-{\v S}ikonja, Marko},
 url = {http://hdl.handle.net/11356/1682},
 note = {Slovenian language resource repository {CLARIN}.{SI}},
 copyright = {Creative Commons - Attribution 4.0 International ({CC} {BY} 4.0)},
 issn = {2820-4042},
 year = {2022} }
"""

_DESCRIPTION = """\
To increase the accessibility and diversity of easy reading in Slovenian and to create a prototype system that automatically simplifies texts in Slovenian, we prepared a dataset for the Slovenian language that contains aligned simple and complex sentences, which can be used for further development of models for simplifying texts in Slovenian.

Dataset is a .json file that usually contains one complex ("kompleksni") and one simplified sentence ("enostavni") per row. However, if a complex sentence contains a lot of information we translated this sentence into more than one simplified sentences. Vice versa, more complex sentences can be translated into one simplified sentence if some information is given through more than one complex sentences but we summarised them into one simplified one.
"""

_HOMEPAGE = "http://hdl.handle.net/11356/1682"

_LICENSE = "Creative Commons - Attribution 4.0 International (CC BY 4.0)"

_URLS = {
    "text_simplification": "https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1682/textSimplification.json?sequence=1&isAllowed=y", # Daj povezavo na podatke iz clarin, ime keyja spremen v neki smiselnega 
}


class TextSimplification(datasets.GeneratorBasedBuilder):
    """Text simplification in Slovenian."""

    VERSION = datasets.Version("1.1.0")

    def _info(self):
       
        features = datasets.Features(
            {
                "complex": datasets.Value("string"),
                "simple": datasets.Value("string"),
            }
        )

        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=features,
            homepage=_HOMEPAGE,
            license=_LICENSE,
            citation=_CITATION,
        )

    def _split_generators(self, dl_manager):
        urls = _URLS["text_simplification"]
        download_path = dl_manager.download(urls) 
        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                
                gen_kwargs={
                    "filepath": download_path,
                },
            ),
            
        ]


    def _generate_examples(self, filepath):
        with open(filepath, "r", encoding='utf-8') as file_obj: 
            for id, line in enumerate(file_obj):
                example = json.loads(line)

                yield id, {
                    "complex": example["kompleksni"],
                    "simple": example["enostavni"]
                }