|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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", |
|
} |
|
|
|
|
|
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"] |
|
} |
|
|