Datasets:
Commit ·
0b7dcda
1
Parent(s): a20fb29
added language
Browse files- lextreme.py +15 -0
lextreme.py
CHANGED
|
@@ -50,6 +50,7 @@ class LextremeConfig(datasets.BuilderConfig):
|
|
| 50 |
url,
|
| 51 |
citation,
|
| 52 |
hf_hub_name,
|
|
|
|
| 53 |
config_name="default",
|
| 54 |
label_classes=None,
|
| 55 |
task_type=None,
|
|
@@ -64,6 +65,7 @@ class LextremeConfig(datasets.BuilderConfig):
|
|
| 64 |
url: `string`, url for the original project
|
| 65 |
citation: `string`, citation for the data set
|
| 66 |
hf_hub_name: `string`, huggingface dataset identifier
|
|
|
|
| 67 |
config_name: `string`, huggingface dataset config name
|
| 68 |
label_classes: `list[string]`, the list of classes if the label is
|
| 69 |
categorical. If not provided, then the label will be of type
|
|
@@ -78,6 +80,7 @@ class LextremeConfig(datasets.BuilderConfig):
|
|
| 78 |
self.description = textwrap.dedent(self.description)
|
| 79 |
self.citation = textwrap.dedent(citation)
|
| 80 |
self.hf_hub_name = hf_hub_name
|
|
|
|
| 81 |
self.config_name = config_name
|
| 82 |
self.label_classes = label_classes
|
| 83 |
self.task_type = task_type
|
|
@@ -86,6 +89,7 @@ class LextremeConfig(datasets.BuilderConfig):
|
|
| 86 |
_BRAZILIAN_COURT_DECISIONS_JUDGMENT = {
|
| 87 |
"task_type": TaskType.SLTC,
|
| 88 |
"hf_hub_name": "joelito/brazilian_court_decisions",
|
|
|
|
| 89 |
"input_col": "decision_description",
|
| 90 |
"label_col": "judgment_label",
|
| 91 |
"url": "https://github.com/lagefreitas/predicting-brazilian-court-decisions",
|
|
@@ -150,6 +154,7 @@ _SWISS_JUDGMENT_PREDICTION = {
|
|
| 150 |
_GERMAN_ARGUMENT_MINING = {
|
| 151 |
"task_type": TaskType.SLTC,
|
| 152 |
"hf_hub_name": "joelito/german_argument_mining",
|
|
|
|
| 153 |
"input_col": "input_sentence",
|
| 154 |
"label_col": "label",
|
| 155 |
"url": "https://zenodo.org/record/3936490#.X1ed7ovgomK",
|
|
@@ -179,6 +184,7 @@ _GERMAN_ARGUMENT_MINING = {
|
|
| 179 |
_GREEK_LEGAL_CODE_VOLUME = {
|
| 180 |
"task_type": TaskType.SLTC,
|
| 181 |
"hf_hub_name": "greek_legal_code",
|
|
|
|
| 182 |
"config_name": "volume",
|
| 183 |
"input_col": "text",
|
| 184 |
"label_col": "label",
|
|
@@ -3766,6 +3772,7 @@ _MULTI_EURLEX_LEVEL_3 = {
|
|
| 3766 |
_LENER_BR = {
|
| 3767 |
"task_type": TaskType.NER,
|
| 3768 |
"hf_hub_name": "lener_br",
|
|
|
|
| 3769 |
"config_name": "lener_br",
|
| 3770 |
"input_col": "tokens",
|
| 3771 |
"label_col": "ner_tags",
|
|
@@ -3813,6 +3820,7 @@ _LENER_BR = {
|
|
| 3813 |
_LEGAL_NERO = {
|
| 3814 |
"task_type": TaskType.NER,
|
| 3815 |
"hf_hub_name": "joelito/legalnero",
|
|
|
|
| 3816 |
"input_col": "words",
|
| 3817 |
"label_col": "ner",
|
| 3818 |
"url": "https://zenodo.org/record/4922385",
|
|
@@ -3853,6 +3861,7 @@ _LEGAL_NERO = {
|
|
| 3853 |
_GREEK_LEGAL_NER = {
|
| 3854 |
"task_type": TaskType.NER,
|
| 3855 |
"hf_hub_name": "joelito/greek_legal_ner",
|
|
|
|
| 3856 |
"input_col": "words",
|
| 3857 |
"label_col": "ner",
|
| 3858 |
"url": "http://legislation.di.uoa.gr/publications?language=en",
|
|
@@ -4006,6 +4015,7 @@ class LEXTREME(datasets.GeneratorBasedBuilder):
|
|
| 4006 |
features=datasets.Features({
|
| 4007 |
"input": input_type,
|
| 4008 |
"label": label_type,
|
|
|
|
| 4009 |
}),
|
| 4010 |
)
|
| 4011 |
|
|
@@ -4030,7 +4040,12 @@ class LEXTREME(datasets.GeneratorBasedBuilder):
|
|
| 4030 |
label = dataset.features[label_col].int2str(label)
|
| 4031 |
if self.config.task_type == TaskType.SLTC and label not in self.config.label_classes:
|
| 4032 |
continue # filter out invalid classes to construct ClassLabel
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4033 |
yield id, {
|
| 4034 |
"input": item[self.config.input_col],
|
| 4035 |
"label": label,
|
|
|
|
| 4036 |
}
|
|
|
|
| 50 |
url,
|
| 51 |
citation,
|
| 52 |
hf_hub_name,
|
| 53 |
+
language="multilingual",
|
| 54 |
config_name="default",
|
| 55 |
label_classes=None,
|
| 56 |
task_type=None,
|
|
|
|
| 65 |
url: `string`, url for the original project
|
| 66 |
citation: `string`, citation for the data set
|
| 67 |
hf_hub_name: `string`, huggingface dataset identifier
|
| 68 |
+
hf_hub_name: `string`, the language of the dataset (either multilingual or a single language ISO code)
|
| 69 |
config_name: `string`, huggingface dataset config name
|
| 70 |
label_classes: `list[string]`, the list of classes if the label is
|
| 71 |
categorical. If not provided, then the label will be of type
|
|
|
|
| 80 |
self.description = textwrap.dedent(self.description)
|
| 81 |
self.citation = textwrap.dedent(citation)
|
| 82 |
self.hf_hub_name = hf_hub_name
|
| 83 |
+
self.language = language
|
| 84 |
self.config_name = config_name
|
| 85 |
self.label_classes = label_classes
|
| 86 |
self.task_type = task_type
|
|
|
|
| 89 |
_BRAZILIAN_COURT_DECISIONS_JUDGMENT = {
|
| 90 |
"task_type": TaskType.SLTC,
|
| 91 |
"hf_hub_name": "joelito/brazilian_court_decisions",
|
| 92 |
+
"language": "pt",
|
| 93 |
"input_col": "decision_description",
|
| 94 |
"label_col": "judgment_label",
|
| 95 |
"url": "https://github.com/lagefreitas/predicting-brazilian-court-decisions",
|
|
|
|
| 154 |
_GERMAN_ARGUMENT_MINING = {
|
| 155 |
"task_type": TaskType.SLTC,
|
| 156 |
"hf_hub_name": "joelito/german_argument_mining",
|
| 157 |
+
"language": "de",
|
| 158 |
"input_col": "input_sentence",
|
| 159 |
"label_col": "label",
|
| 160 |
"url": "https://zenodo.org/record/3936490#.X1ed7ovgomK",
|
|
|
|
| 184 |
_GREEK_LEGAL_CODE_VOLUME = {
|
| 185 |
"task_type": TaskType.SLTC,
|
| 186 |
"hf_hub_name": "greek_legal_code",
|
| 187 |
+
"language": "el",
|
| 188 |
"config_name": "volume",
|
| 189 |
"input_col": "text",
|
| 190 |
"label_col": "label",
|
|
|
|
| 3772 |
_LENER_BR = {
|
| 3773 |
"task_type": TaskType.NER,
|
| 3774 |
"hf_hub_name": "lener_br",
|
| 3775 |
+
"language": "pt",
|
| 3776 |
"config_name": "lener_br",
|
| 3777 |
"input_col": "tokens",
|
| 3778 |
"label_col": "ner_tags",
|
|
|
|
| 3820 |
_LEGAL_NERO = {
|
| 3821 |
"task_type": TaskType.NER,
|
| 3822 |
"hf_hub_name": "joelito/legalnero",
|
| 3823 |
+
"language": "ro",
|
| 3824 |
"input_col": "words",
|
| 3825 |
"label_col": "ner",
|
| 3826 |
"url": "https://zenodo.org/record/4922385",
|
|
|
|
| 3861 |
_GREEK_LEGAL_NER = {
|
| 3862 |
"task_type": TaskType.NER,
|
| 3863 |
"hf_hub_name": "joelito/greek_legal_ner",
|
| 3864 |
+
"language": "el",
|
| 3865 |
"input_col": "words",
|
| 3866 |
"label_col": "ner",
|
| 3867 |
"url": "http://legislation.di.uoa.gr/publications?language=en",
|
|
|
|
| 4015 |
features=datasets.Features({
|
| 4016 |
"input": input_type,
|
| 4017 |
"label": label_type,
|
| 4018 |
+
"language": datasets.Value("string"),
|
| 4019 |
}),
|
| 4020 |
)
|
| 4021 |
|
|
|
|
| 4040 |
label = dataset.features[label_col].int2str(label)
|
| 4041 |
if self.config.task_type == TaskType.SLTC and label not in self.config.label_classes:
|
| 4042 |
continue # filter out invalid classes to construct ClassLabel
|
| 4043 |
+
if "language" in item.keys():
|
| 4044 |
+
language = item["language"]
|
| 4045 |
+
else:
|
| 4046 |
+
language = self.config.language
|
| 4047 |
yield id, {
|
| 4048 |
"input": item[self.config.input_col],
|
| 4049 |
"label": label,
|
| 4050 |
+
"language": language,
|
| 4051 |
}
|