Datasets:
cjvt
/

Languages:
Slovenian
Size:
n<1K
License:
hanaskitek commited on
Commit
7a5d175
1 Parent(s): 5320ec6

SloTS version1

Browse files
Files changed (1) hide show
  1. sloTS.py +94 -0
sloTS.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import csv
17
+ import json
18
+ import os
19
+
20
+ import datasets
21
+
22
+
23
+ _CITATION = """\
24
+ @misc{11356/1682,
25
+ title = {Slovene text simplification dataset {SloTS}},
26
+ author = {Gorenc, Sabina and Robnik-{\v S}ikonja, Marko},
27
+ url = {http://hdl.handle.net/11356/1682},
28
+ note = {Slovenian language resource repository {CLARIN}.{SI}},
29
+ copyright = {Creative Commons - Attribution 4.0 International ({CC} {BY} 4.0)},
30
+ issn = {2820-4042},
31
+ year = {2022} }
32
+ """
33
+
34
+ _DESCRIPTION = """\
35
+ 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.
36
+
37
+ 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.
38
+ """
39
+
40
+ _HOMEPAGE = "http://hdl.handle.net/11356/1682"
41
+
42
+ _LICENSE = "Creative Commons - Attribution 4.0 International (CC BY 4.0)"
43
+
44
+ _URLS = {
45
+ "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
46
+ }
47
+
48
+
49
+ class TextSimplification(datasets.GeneratorBasedBuilder):
50
+ """Text simplification in Slovenian."""
51
+
52
+ VERSION = datasets.Version("1.1.0")
53
+
54
+ def _info(self):
55
+
56
+ features = datasets.Features(
57
+ {
58
+ "complex": datasets.Value("string"),
59
+ "simple": datasets.Value("string"),
60
+ }
61
+ )
62
+
63
+ return datasets.DatasetInfo(
64
+ description=_DESCRIPTION,
65
+ features=features,
66
+ homepage=_HOMEPAGE,
67
+ license=_LICENSE,
68
+ citation=_CITATION,
69
+ )
70
+
71
+ def _split_generators(self, dl_manager):
72
+ urls = _URLS["text_simplification"]
73
+ download_path = dl_manager.download(urls)
74
+ return [
75
+ datasets.SplitGenerator(
76
+ name=datasets.Split.TRAIN,
77
+
78
+ gen_kwargs={
79
+ "filepath": download_path,
80
+ },
81
+ ),
82
+
83
+ ]
84
+
85
+
86
+ def _generate_examples(self, filepath):
87
+ with open(filepath, "r", encoding='utf-8') as file_obj:
88
+ for id, line in enumerate(file_obj):
89
+ example = json.loads(line)
90
+
91
+ yield id, {
92
+ "complex": example["kompleksni"],
93
+ "simple": example["enostavni"]
94
+ }