Datasets:
Tasks:
Text Classification
Languages:
French
Multilinguality:
monolingual
Size Categories:
10K<n<100K
Language Creators:
crowdsourced
Source Datasets:
original
ArXiv:
License:
Update files from the datasets library (from 1.6.0)
Browse filesRelease notes: https://github.com/huggingface/datasets/releases/tag/1.6.0
flue.py
CHANGED
@@ -16,7 +16,6 @@
|
|
16 |
# Lint as: python3
|
17 |
"""The French Language Understanding Evaluation (FLUE) benchmark."""
|
18 |
|
19 |
-
from __future__ import absolute_import, division, print_function
|
20 |
|
21 |
import csv
|
22 |
import os
|
@@ -25,7 +24,6 @@ import textwrap
|
|
25 |
import unicodedata
|
26 |
from shutil import copyfile
|
27 |
|
28 |
-
import six
|
29 |
from lxml import etree
|
30 |
|
31 |
import datasets
|
@@ -203,15 +201,13 @@ class Flue(datasets.GeneratorBasedBuilder):
|
|
203 |
|
204 |
def _info(self):
|
205 |
if self.config.name == "CLS" or self.config.name == "XNLI":
|
206 |
-
features = {
|
207 |
-
text_feature: datasets.Value("string") for text_feature in six.iterkeys(self.config.text_features)
|
208 |
-
}
|
209 |
features[self.config.label_column] = datasets.features.ClassLabel(names=self.config.label_classes)
|
210 |
features["idx"] = datasets.Value("int32")
|
211 |
elif self.config.name == "WSD-V":
|
212 |
features = {
|
213 |
text_feature: datasets.Sequence(datasets.Value("string"))
|
214 |
-
for text_feature in
|
215 |
}
|
216 |
features["fine_pos_tags"] = datasets.Sequence(
|
217 |
datasets.features.ClassLabel(
|
@@ -275,9 +271,7 @@ class Flue(datasets.GeneratorBasedBuilder):
|
|
275 |
features["disambiguate_labels"] = datasets.Sequence(datasets.Value("string"))
|
276 |
features["idx"] = datasets.Value("string")
|
277 |
else:
|
278 |
-
features = {
|
279 |
-
text_feature: datasets.Value("string") for text_feature in six.iterkeys(self.config.text_features)
|
280 |
-
}
|
281 |
features[self.config.label_column] = datasets.Value("int32")
|
282 |
features["idx"] = datasets.Value("int32")
|
283 |
return datasets.DatasetInfo(
|
@@ -467,16 +461,16 @@ class Flue(datasets.GeneratorBasedBuilder):
|
|
467 |
Converts `text` to Unicode (if it's not already), assuming UTF-8 input.
|
468 |
from: https://github.com/getalp/Flaubert/blob/master/tools/clean_text.py
|
469 |
"""
|
470 |
-
|
471 |
-
def
|
472 |
-
if isinstance(s,
|
473 |
return s.decode(encoding, errors)
|
474 |
-
elif isinstance(s,
|
475 |
return s
|
476 |
else:
|
477 |
raise TypeError("not expecting type '%s'" % type(s))
|
478 |
|
479 |
-
return
|
480 |
|
481 |
def _cleaner(self, text):
|
482 |
"""
|
16 |
# Lint as: python3
|
17 |
"""The French Language Understanding Evaluation (FLUE) benchmark."""
|
18 |
|
|
|
19 |
|
20 |
import csv
|
21 |
import os
|
24 |
import unicodedata
|
25 |
from shutil import copyfile
|
26 |
|
|
|
27 |
from lxml import etree
|
28 |
|
29 |
import datasets
|
201 |
|
202 |
def _info(self):
|
203 |
if self.config.name == "CLS" or self.config.name == "XNLI":
|
204 |
+
features = {text_feature: datasets.Value("string") for text_feature in self.config.text_features.keys()}
|
|
|
|
|
205 |
features[self.config.label_column] = datasets.features.ClassLabel(names=self.config.label_classes)
|
206 |
features["idx"] = datasets.Value("int32")
|
207 |
elif self.config.name == "WSD-V":
|
208 |
features = {
|
209 |
text_feature: datasets.Sequence(datasets.Value("string"))
|
210 |
+
for text_feature in self.config.text_features.keys()
|
211 |
}
|
212 |
features["fine_pos_tags"] = datasets.Sequence(
|
213 |
datasets.features.ClassLabel(
|
271 |
features["disambiguate_labels"] = datasets.Sequence(datasets.Value("string"))
|
272 |
features["idx"] = datasets.Value("string")
|
273 |
else:
|
274 |
+
features = {text_feature: datasets.Value("string") for text_feature in self.config.text_features.keys()}
|
|
|
|
|
275 |
features[self.config.label_column] = datasets.Value("int32")
|
276 |
features["idx"] = datasets.Value("int32")
|
277 |
return datasets.DatasetInfo(
|
461 |
Converts `text` to Unicode (if it's not already), assuming UTF-8 input.
|
462 |
from: https://github.com/getalp/Flaubert/blob/master/tools/clean_text.py
|
463 |
"""
|
464 |
+
|
465 |
+
def ensure_text(s, encoding="utf-8", errors="strict"):
|
466 |
+
if isinstance(s, bytes):
|
467 |
return s.decode(encoding, errors)
|
468 |
+
elif isinstance(s, str):
|
469 |
return s
|
470 |
else:
|
471 |
raise TypeError("not expecting type '%s'" % type(s))
|
472 |
|
473 |
+
return ensure_text(text, encoding="utf-8", errors="ignore")
|
474 |
|
475 |
def _cleaner(self, text):
|
476 |
"""
|