fernando-peres
commited on
Commit
·
6a4afbf
1
Parent(s):
44bce36
Builder in one file
Browse files- py_legislation.py +91 -56
py_legislation.py
CHANGED
|
@@ -22,6 +22,86 @@ import pyarrow.parquet as pq
|
|
| 22 |
|
| 23 |
from obligations import affected_entity, cost_type, aa_categories, aa_categories_unique, io_categories
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
_metadata = {
|
| 26 |
"citation": """\
|
| 27 |
@InProceedings{
|
|
@@ -76,14 +156,14 @@ _metadata = {
|
|
| 76 |
"text": datasets.Value(dtype="string"),
|
| 77 |
|
| 78 |
# Categories
|
| 79 |
-
"cost_type": datasets.ClassLabel(names=cost_type,),
|
| 80 |
-
"affected_entity": datasets.ClassLabel(names=affected_entity,),
|
| 81 |
"io_categories": datasets.Sequence(
|
| 82 |
-
datasets.ClassLabel(names=io_categories,)),
|
| 83 |
"aa_categories": datasets.Sequence(
|
| 84 |
-
datasets.ClassLabel(names=aa_categories,)),
|
| 85 |
"aa_categories_unique": datasets.Sequence(
|
| 86 |
-
datasets.ClassLabel(names=aa_categories_unique,)),
|
| 87 |
}
|
| 88 |
},
|
| 89 |
|
|
@@ -101,63 +181,18 @@ _metadata = {
|
|
| 101 |
"text": datasets.Value(dtype="string"),
|
| 102 |
|
| 103 |
# Categories
|
| 104 |
-
"cost_type": datasets.ClassLabel(names=cost_type,),
|
| 105 |
-
"affected_entity": datasets.ClassLabel(names=affected_entity,),
|
| 106 |
"io_categories": datasets.Sequence(
|
| 107 |
-
datasets.ClassLabel(names=io_categories,)),
|
| 108 |
"aa_categories": datasets.Sequence(
|
| 109 |
-
datasets.ClassLabel(names=aa_categories,)),
|
| 110 |
"aa_categories_unique": datasets.Sequence(
|
| 111 |
-
datasets.ClassLabel(names=aa_categories_unique,)),
|
| 112 |
-
}
|
| 113 |
-
}
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
x = {
|
| 118 |
-
"config_names": {
|
| 119 |
-
"raw": {
|
| 120 |
-
"description": "",
|
| 121 |
-
"features": {
|
| 122 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 123 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 124 |
-
"document": datasets.Value(dtype="string"),
|
| 125 |
-
"text": datasets.Value(dtype="string"),
|
| 126 |
-
}
|
| 127 |
}
|
| 128 |
}
|
| 129 |
}
|
| 130 |
|
| 131 |
-
BASIC_FEATURES_SPEC = {
|
| 132 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 133 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 134 |
-
"document": datasets.Value(dtype="string"),
|
| 135 |
-
"text": datasets.Value(dtype="string"),
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
RAW_FEATURES_SPEC = {
|
| 139 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 140 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 141 |
-
"document": datasets.Value(dtype="string"),
|
| 142 |
-
"text": datasets.Value(dtype="string"),
|
| 143 |
-
}
|
| 144 |
-
|
| 145 |
-
SENTENCES_UNLABELED_FEATURES_SPEC = {
|
| 146 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 147 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 148 |
-
"document": datasets.Value(dtype="string"),
|
| 149 |
-
"text": datasets.Value(dtype="string"),
|
| 150 |
-
|
| 151 |
-
#
|
| 152 |
-
|
| 153 |
-
# Categories
|
| 154 |
-
"cost_type": datasets.ClassLabel(names=cost_type,),
|
| 155 |
-
"affected_entity": datasets.ClassLabel(names=affected_entity,),
|
| 156 |
-
"io_categories": datasets.Sequence(datasets.ClassLabel(names=io_categories,)),
|
| 157 |
-
"aa_categories": datasets.Sequence(datasets.ClassLabel(names=aa_categories,)),
|
| 158 |
-
"aa_categories_unique": datasets.Sequence(datasets.ClassLabel(names=aa_categories_unique,)),
|
| 159 |
-
}
|
| 160 |
-
|
| 161 |
|
| 162 |
class PY_legislation(datasets.GeneratorBasedBuilder):
|
| 163 |
VERSION = datasets.Version("1.0.0")
|
|
@@ -202,7 +237,7 @@ class PY_legislation(datasets.GeneratorBasedBuilder):
|
|
| 202 |
|
| 203 |
else:
|
| 204 |
features = datasets.Features(
|
| 205 |
-
|
| 206 |
)
|
| 207 |
|
| 208 |
return datasets.DatasetInfo(
|
|
|
|
| 22 |
|
| 23 |
from obligations import affected_entity, cost_type, aa_categories, aa_categories_unique, io_categories
|
| 24 |
|
| 25 |
+
|
| 26 |
+
_obligations = {
|
| 27 |
+
"cost_type": ["sin_costo", "costo_adm", "costo_directo", "otro_costo"],
|
| 28 |
+
|
| 29 |
+
"affected_entity": ["ent_no_afectada", "empresas", "ciudadanos", "adm_publica"],
|
| 30 |
+
|
| 31 |
+
"io_categories": [
|
| 32 |
+
"prestacion_de_informacion_empresarial_y_fiscal"
|
| 33 |
+
"solicitudes_de_licencias_y_otras"
|
| 34 |
+
"registros_y_notificaciones"
|
| 35 |
+
"solicitud_de_subsidios_y_otras"
|
| 36 |
+
"disponibilidad_de_manuales_y_otras"
|
| 37 |
+
"cooperacion_con_auditorías_y_otras"
|
| 38 |
+
"prestacion_de_informacion_a_consumidores"
|
| 39 |
+
"otras_OIS"
|
| 40 |
+
],
|
| 41 |
+
|
| 42 |
+
"aa_categories_unique": [
|
| 43 |
+
"familiarizacion_con_OI"
|
| 44 |
+
"recoleccion_y_organizacion_de_informacion"
|
| 45 |
+
"procesamiento_de_informacion"
|
| 46 |
+
"tiempos_de_espera"
|
| 47 |
+
"desplazamientos"
|
| 48 |
+
"envio_de_informacion"
|
| 49 |
+
"preservacion_de_informacion"
|
| 50 |
+
],
|
| 51 |
+
|
| 52 |
+
"aa_categories": [
|
| 53 |
+
"aa_1_familiarizacion_con_OI"
|
| 54 |
+
"aa_1_recoleccion_y_organizacion_de_informacion"
|
| 55 |
+
"aa_1_procesamiento_de_informacion"
|
| 56 |
+
"aa_1_tiempos_de_espera"
|
| 57 |
+
"aa_1_desplazamientos"
|
| 58 |
+
"aa_1_envio_de_informacion"
|
| 59 |
+
"aa_1_preservacion_de_informacion"
|
| 60 |
+
"aa_2_familiarizacion_con_OI"
|
| 61 |
+
"aa_2_recoleccion_y_organizacion_de_informacion"
|
| 62 |
+
"aa_2_procesamiento_de_informacion"
|
| 63 |
+
"aa_2_tiempos_de_espera"
|
| 64 |
+
"aa_2_desplazamientos"
|
| 65 |
+
"aa_2_envio_de_informacion"
|
| 66 |
+
"aa_2_preservacion_de_informacion"
|
| 67 |
+
"aa_3_familiarizacion_con_OI"
|
| 68 |
+
"aa_3_recoleccion_y_organizacion_de_informacion"
|
| 69 |
+
"aa_3_procesamiento_de_informacion"
|
| 70 |
+
"aa_3_tiempos_de_espera"
|
| 71 |
+
"aa_3_desplazamientos"
|
| 72 |
+
"aa_3_envio_de_informacion"
|
| 73 |
+
"aa_3_preservacion_de_informacion"
|
| 74 |
+
"aa_4_familiarizacion_con_OI"
|
| 75 |
+
"aa_4_recoleccion_y_organizacion_de_informacion"
|
| 76 |
+
"aa_4_procesamiento_de_informacion"
|
| 77 |
+
"aa_4_tiempos_de_espera"
|
| 78 |
+
"aa_4_desplazamientos"
|
| 79 |
+
"aa_4_envio_de_informacion"
|
| 80 |
+
"aa_4_preservacion_de_informacion"
|
| 81 |
+
"aa_5_familiarizacion_con_OI"
|
| 82 |
+
"aa_5_recoleccion_y_organizacion_de_informacion"
|
| 83 |
+
"aa_5_procesamiento_de_informacion"
|
| 84 |
+
"aa_5_tiempos_de_espera"
|
| 85 |
+
"aa_5_desplazamientos"
|
| 86 |
+
"aa_5_envio_de_informacion"
|
| 87 |
+
"aa_5_preservacion_de_informacion"
|
| 88 |
+
"aa_6_familiarizacion_con_OI"
|
| 89 |
+
"aa_6_recoleccion_y_organizacion_de_informacion"
|
| 90 |
+
"aa_6_procesamiento_de_informacion"
|
| 91 |
+
"aa_6_tiempos_de_espera"
|
| 92 |
+
"aa_6_desplazamientos"
|
| 93 |
+
"aa_6_envio_de_informacion"
|
| 94 |
+
"aa_6_preservacion_de_informacion"
|
| 95 |
+
"aa_7_familiarizacion_con_OI"
|
| 96 |
+
"aa_7_recoleccion_y_organizacion_de_informacion"
|
| 97 |
+
"aa_7_procesamiento_de_informacion"
|
| 98 |
+
"aa_7_tiempos_de_espera"
|
| 99 |
+
"aa_7_desplazamientos"
|
| 100 |
+
"aa_7_envio_de_informacion"
|
| 101 |
+
"aa_7_preservacion_de_informacion"
|
| 102 |
+
]
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
_metadata = {
|
| 106 |
"citation": """\
|
| 107 |
@InProceedings{
|
|
|
|
| 156 |
"text": datasets.Value(dtype="string"),
|
| 157 |
|
| 158 |
# Categories
|
| 159 |
+
"cost_type": datasets.ClassLabel(names=_obligations["cost_type"],),
|
| 160 |
+
"affected_entity": datasets.ClassLabel(names=_obligations["affected_entity"],),
|
| 161 |
"io_categories": datasets.Sequence(
|
| 162 |
+
datasets.ClassLabel(names=_obligations["io_categories"],)),
|
| 163 |
"aa_categories": datasets.Sequence(
|
| 164 |
+
datasets.ClassLabel(names=_obligations["aa_categories"],)),
|
| 165 |
"aa_categories_unique": datasets.Sequence(
|
| 166 |
+
datasets.ClassLabel(names=_obligations["aa_categories_unique"],)),
|
| 167 |
}
|
| 168 |
},
|
| 169 |
|
|
|
|
| 181 |
"text": datasets.Value(dtype="string"),
|
| 182 |
|
| 183 |
# Categories
|
| 184 |
+
"cost_type": datasets.ClassLabel(names=_obligations["cost_type"],),
|
| 185 |
+
"affected_entity": datasets.ClassLabel(names=_obligations["affected_entity"],),
|
| 186 |
"io_categories": datasets.Sequence(
|
| 187 |
+
datasets.ClassLabel(names=_obligations["io_categories"],)),
|
| 188 |
"aa_categories": datasets.Sequence(
|
| 189 |
+
datasets.ClassLabel(names=_obligations["aa_categories"],)),
|
| 190 |
"aa_categories_unique": datasets.Sequence(
|
| 191 |
+
datasets.ClassLabel(names=_obligations["aa_categories_unique"],)),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
}
|
| 193 |
}
|
| 194 |
}
|
| 195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
class PY_legislation(datasets.GeneratorBasedBuilder):
|
| 198 |
VERSION = datasets.Version("1.0.0")
|
|
|
|
| 237 |
|
| 238 |
else:
|
| 239 |
features = datasets.Features(
|
| 240 |
+
_metadata["raw"]["description"]
|
| 241 |
)
|
| 242 |
|
| 243 |
return datasets.DatasetInfo(
|