Update NER_Gujarati_data.py
Browse files- NER_Gujarati_data.py +42 -28
NER_Gujarati_data.py
CHANGED
@@ -1,32 +1,57 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
import datasets
|
5 |
|
|
|
|
|
|
|
6 |
_CITATION = """\
|
7 |
"""
|
8 |
|
9 |
_DESCRIPTION = """\
|
10 |
"""
|
11 |
|
12 |
-
_URL = "https://huggingface.co/datasets/Red-8/NER_Gujarati_data/
|
|
|
|
|
|
|
|
|
13 |
|
14 |
class RedConfig(datasets.BuilderConfig):
|
15 |
-
"""BuilderConfig for Red
|
16 |
|
17 |
def __init__(self, **kwargs):
|
18 |
-
"""BuilderConfig
|
|
|
19 |
Args:
|
20 |
**kwargs: keyword arguments forwarded to super.
|
21 |
"""
|
22 |
super(RedConfig, self).__init__(**kwargs)
|
23 |
|
|
|
24 |
class Red(datasets.GeneratorBasedBuilder):
|
|
|
25 |
|
26 |
BUILDER_CONFIGS = [
|
27 |
-
RedConfig(
|
28 |
-
name="NER_Gujarati_data", version=datasets.Version("1.0.0")
|
29 |
-
),
|
30 |
]
|
31 |
|
32 |
def _info(self):
|
@@ -60,28 +85,17 @@ class Red(datasets.GeneratorBasedBuilder):
|
|
60 |
|
61 |
def _split_generators(self, dl_manager):
|
62 |
"""Returns SplitGenerators."""
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
65 |
|
66 |
return [
|
67 |
-
datasets.SplitGenerator(
|
68 |
-
|
69 |
-
|
70 |
-
"filepath": os.path.join(data_dir,"train_data.json"),
|
71 |
-
},
|
72 |
-
),
|
73 |
-
datasets.SplitGenerator(
|
74 |
-
name=datasets.Split.TEST,
|
75 |
-
gen_kwargs={
|
76 |
-
"filepath": os.path.join(data_dir,"test_data.json"),
|
77 |
-
},
|
78 |
-
),
|
79 |
-
datasets.SplitGenerator(
|
80 |
-
name=datasets.Split.VALIDATION,
|
81 |
-
gen_kwargs={
|
82 |
-
"filepath": os.path.join(data_dir,"val_data.json"),
|
83 |
-
},
|
84 |
-
),
|
85 |
]
|
86 |
|
87 |
def _generate_examples(self, filepath):
|
|
|
1 |
+
# coding=utf-8
|
2 |
+
# Copyright 2020 HuggingFace Datasets Authors.
|
3 |
+
#
|
4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5 |
+
# you may not use this file except in compliance with the License.
|
6 |
+
# You may obtain a copy of the License at
|
7 |
+
#
|
8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9 |
+
#
|
10 |
+
# Unless required by applicable law or agreed to in writing, software
|
11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 |
+
# See the License for the specific language governing permissions and
|
14 |
+
# limitations under the License.
|
15 |
|
16 |
+
# Lint as: python3
|
17 |
+
"""Introduction to the CoNLL-2003 Shared Task: Language-Independent Named Entity Recognition"""
|
18 |
+
|
19 |
+
import os
|
20 |
+
import json
|
21 |
import datasets
|
22 |
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
_CITATION = """\
|
27 |
"""
|
28 |
|
29 |
_DESCRIPTION = """\
|
30 |
"""
|
31 |
|
32 |
+
_URL = "https://huggingface.co/datasets/Red-8/NER_Gujarati_data/resolve/main/data/datas.zip"
|
33 |
+
_TRAINING_FILE = "train_data.json"
|
34 |
+
_DEV_FILE = "val_data.json"
|
35 |
+
_TEST_FILE = "test_data.json"
|
36 |
+
|
37 |
|
38 |
class RedConfig(datasets.BuilderConfig):
|
39 |
+
"""BuilderConfig for Red"""
|
40 |
|
41 |
def __init__(self, **kwargs):
|
42 |
+
"""BuilderConfig forRed.
|
43 |
+
|
44 |
Args:
|
45 |
**kwargs: keyword arguments forwarded to super.
|
46 |
"""
|
47 |
super(RedConfig, self).__init__(**kwargs)
|
48 |
|
49 |
+
|
50 |
class Red(datasets.GeneratorBasedBuilder):
|
51 |
+
"""Red dataset."""
|
52 |
|
53 |
BUILDER_CONFIGS = [
|
54 |
+
RedConfig(name="NER_Gujarati_data", version=datasets.Version("1.0.0"), description="Red dataset"),
|
|
|
|
|
55 |
]
|
56 |
|
57 |
def _info(self):
|
|
|
85 |
|
86 |
def _split_generators(self, dl_manager):
|
87 |
"""Returns SplitGenerators."""
|
88 |
+
downloaded_file = dl_manager.download_and_extract(_URL)
|
89 |
+
data_files = {
|
90 |
+
"train": os.path.join(downloaded_file, _TRAINING_FILE),
|
91 |
+
"dev": os.path.join(downloaded_file, _DEV_FILE),
|
92 |
+
"test": os.path.join(downloaded_file, _TEST_FILE),
|
93 |
+
}
|
94 |
|
95 |
return [
|
96 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_files["train"]}),
|
97 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": data_files["dev"]}),
|
98 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": data_files["test"]}),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
]
|
100 |
|
101 |
def _generate_examples(self, filepath):
|