loader
Browse files- iceErrorCorpus.py +2 -23
iceErrorCorpus.py
CHANGED
@@ -24,7 +24,6 @@ _CITATION = """
|
|
24 |
year = {2021} }
|
25 |
"""
|
26 |
|
27 |
-
# TODO: Add the licence for the dataset here if you can find it
|
28 |
_LICENSE = "CC BY 4.0"
|
29 |
|
30 |
_URLS = {
|
@@ -39,33 +38,20 @@ class iceErrorCorpus(datasets.GeneratorBasedBuilder):
|
|
39 |
|
40 |
VERSION = datasets.Version("1.0.0")
|
41 |
|
42 |
-
# This is an example of a dataset with multiple configurations.
|
43 |
-
# If you don't want/need to define several sub-sets in your dataset,
|
44 |
-
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
45 |
-
|
46 |
-
# If you need to make complex sub-parts in the datasets with configurable options
|
47 |
-
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
48 |
-
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
49 |
-
|
50 |
-
# You will be able to load one or the other configurations in the following list with
|
51 |
-
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
52 |
-
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
53 |
BUILDER_CONFIGS = [
|
54 |
datasets.BuilderConfig(
|
55 |
name="iceErrorCorpus", version=VERSION, description="Icelandic GEC corpus"
|
56 |
),
|
57 |
]
|
58 |
|
59 |
-
DEFAULT_CONFIG_NAME = "iceErrorCorpus"
|
60 |
|
61 |
def _info(self):
|
62 |
-
|
63 |
-
if self.config.name == "iceErrorCorpus": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
64 |
features = datasets.Features(
|
65 |
{
|
66 |
"src": datasets.Value("string"),
|
67 |
"tgt": datasets.Value("string"),
|
68 |
-
# These are the features of your dataset like images, labels ...
|
69 |
}
|
70 |
)
|
71 |
|
@@ -88,12 +74,6 @@ class iceErrorCorpus(datasets.GeneratorBasedBuilder):
|
|
88 |
|
89 |
def _split_generators(self, dl_manager):
|
90 |
"""Returns SplitGenerators."""
|
91 |
-
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
92 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
93 |
-
|
94 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs
|
95 |
-
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
96 |
-
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
97 |
data_dir = dl_manager.download_and_extract(_URLS)
|
98 |
return [
|
99 |
datasets.SplitGenerator(
|
@@ -133,7 +113,6 @@ class iceErrorCorpus(datasets.GeneratorBasedBuilder):
|
|
133 |
key = 0
|
134 |
tsv_f = csv.reader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
135 |
for row in tsv_f:
|
136 |
-
print(row)
|
137 |
if self.config.name == "iceErrorCorpus":
|
138 |
yield key, {
|
139 |
"src": row[0],
|
|
|
24 |
year = {2021} }
|
25 |
"""
|
26 |
|
|
|
27 |
_LICENSE = "CC BY 4.0"
|
28 |
|
29 |
_URLS = {
|
|
|
38 |
|
39 |
VERSION = datasets.Version("1.0.0")
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
BUILDER_CONFIGS = [
|
42 |
datasets.BuilderConfig(
|
43 |
name="iceErrorCorpus", version=VERSION, description="Icelandic GEC corpus"
|
44 |
),
|
45 |
]
|
46 |
|
47 |
+
DEFAULT_CONFIG_NAME = "iceErrorCorpus"
|
48 |
|
49 |
def _info(self):
|
50 |
+
if self.config.name == "iceErrorCorpus":
|
|
|
51 |
features = datasets.Features(
|
52 |
{
|
53 |
"src": datasets.Value("string"),
|
54 |
"tgt": datasets.Value("string"),
|
|
|
55 |
}
|
56 |
)
|
57 |
|
|
|
74 |
|
75 |
def _split_generators(self, dl_manager):
|
76 |
"""Returns SplitGenerators."""
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
data_dir = dl_manager.download_and_extract(_URLS)
|
78 |
return [
|
79 |
datasets.SplitGenerator(
|
|
|
113 |
key = 0
|
114 |
tsv_f = csv.reader(f, delimiter="\t", quoting=csv.QUOTE_NONE)
|
115 |
for row in tsv_f:
|
|
|
116 |
if self.config.name == "iceErrorCorpus":
|
117 |
yield key, {
|
118 |
"src": row[0],
|