Kosuke-Yamada
commited on
Commit
•
707ae5a
1
Parent(s):
e01c16e
modify the difinition of features
Browse files- ner-wikipedia-dataset.py +13 -9
ner-wikipedia-dataset.py
CHANGED
@@ -96,17 +96,17 @@ class NerWikipediaDataset(datasets.GeneratorBasedBuilder):
|
|
96 |
# This defines the different columns of the dataset and their types
|
97 |
features=datasets.Features(
|
98 |
{
|
99 |
-
"curid": datasets.Value("
|
100 |
"text": datasets.Value("string"),
|
101 |
"entities": datasets.Sequence(
|
102 |
-
|
103 |
"name": datasets.Value(dtype="string"),
|
104 |
"span": datasets.Sequence(
|
105 |
-
|
106 |
),
|
107 |
"type": datasets.Value(dtype="string"),
|
108 |
-
}
|
109 |
-
)
|
110 |
# These are the features of your dataset like images, labels ...
|
111 |
}
|
112 |
), # Here we define them above because they are different between the two configurations
|
@@ -149,22 +149,26 @@ class NerWikipediaDataset(datasets.GeneratorBasedBuilder):
|
|
149 |
test_data = data[validation_split:]
|
150 |
|
151 |
return [
|
|
|
|
|
|
|
|
|
152 |
datasets.SplitGenerator(
|
153 |
name=datasets.Split.TRAIN,
|
154 |
-
gen_kwargs={"data": train_data
|
155 |
),
|
156 |
datasets.SplitGenerator(
|
157 |
name=datasets.Split.VALIDATION,
|
158 |
-
gen_kwargs={"data": validation_data
|
159 |
),
|
160 |
datasets.SplitGenerator(
|
161 |
name=datasets.Split.TEST,
|
162 |
-
gen_kwargs={"data": test_data
|
163 |
),
|
164 |
]
|
165 |
|
166 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
167 |
-
def _generate_examples(self, data
|
168 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
169 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
170 |
for key, data in enumerate(data):
|
|
|
96 |
# This defines the different columns of the dataset and their types
|
97 |
features=datasets.Features(
|
98 |
{
|
99 |
+
"curid": datasets.Value("string"),
|
100 |
"text": datasets.Value("string"),
|
101 |
"entities": datasets.Sequence(
|
102 |
+
{
|
103 |
"name": datasets.Value(dtype="string"),
|
104 |
"span": datasets.Sequence(
|
105 |
+
datasets.Value(dtype="int64"), length=2
|
106 |
),
|
107 |
"type": datasets.Value(dtype="string"),
|
108 |
+
}
|
109 |
+
),
|
110 |
# These are the features of your dataset like images, labels ...
|
111 |
}
|
112 |
), # Here we define them above because they are different between the two configurations
|
|
|
149 |
test_data = data[validation_split:]
|
150 |
|
151 |
return [
|
152 |
+
datasets.SplitGenerator(
|
153 |
+
name=datasets.Split.ALL,
|
154 |
+
gen_kwargs={"data": data},
|
155 |
+
),
|
156 |
datasets.SplitGenerator(
|
157 |
name=datasets.Split.TRAIN,
|
158 |
+
gen_kwargs={"data": train_data},
|
159 |
),
|
160 |
datasets.SplitGenerator(
|
161 |
name=datasets.Split.VALIDATION,
|
162 |
+
gen_kwargs={"data": validation_data},
|
163 |
),
|
164 |
datasets.SplitGenerator(
|
165 |
name=datasets.Split.TEST,
|
166 |
+
gen_kwargs={"data": test_data},
|
167 |
),
|
168 |
]
|
169 |
|
170 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
171 |
+
def _generate_examples(self, data):
|
172 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
173 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
174 |
for key, data in enumerate(data):
|