fernando-peres
commited on
Commit
·
9db4098
1
Parent(s):
f3007b2
resolving card bugs
Browse files- .gitignore +5 -1
- config.py +0 -2
- features_specs.py +0 -34
- obligations.py +0 -200
- py_legislation_metadata.py +0 -69
.gitignore
CHANGED
|
@@ -1,4 +1,8 @@
|
|
| 1 |
env
|
| 2 |
/env
|
| 3 |
.vscode
|
| 4 |
-
/.vscode
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
env
|
| 2 |
/env
|
| 3 |
.vscode
|
| 4 |
+
/.vscode
|
| 5 |
+
features_specs.py
|
| 6 |
+
obligations.py
|
| 7 |
+
py_legislation_metadata.py
|
| 8 |
+
config.py
|
config.py
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
LANGUAGE = "ES"
|
|
|
|
|
|
|
|
|
features_specs.py
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import datasets
|
| 4 |
-
from obligations import affected_entity, cost_type, aa_categories, aa_categories_unique, io_categories
|
| 5 |
-
|
| 6 |
-
BASIC_FEATURES_SPEC = {
|
| 7 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 8 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 9 |
-
"document": datasets.Value(dtype="string"),
|
| 10 |
-
"text": datasets.Value(dtype="string"),
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
RAW_FEATURES_SPEC = {
|
| 14 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 15 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 16 |
-
"document": datasets.Value(dtype="string"),
|
| 17 |
-
"text": datasets.Value(dtype="string"),
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
SENTENCES_UNLABELED_FEATURES_SPEC = {
|
| 21 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 22 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 23 |
-
"document": datasets.Value(dtype="string"),
|
| 24 |
-
"text": datasets.Value(dtype="string"),
|
| 25 |
-
|
| 26 |
-
#
|
| 27 |
-
|
| 28 |
-
# Categories
|
| 29 |
-
"cost_type": datasets.ClassLabel(names=cost_type,),
|
| 30 |
-
"affected_entity": datasets.ClassLabel(names=affected_entity,),
|
| 31 |
-
"io_categories": datasets.Sequence(datasets.ClassLabel(names=io_categories,)),
|
| 32 |
-
"aa_categories": datasets.Sequence(datasets.ClassLabel(names=aa_categories,)),
|
| 33 |
-
"aa_categories_unique": datasets.Sequence(datasets.ClassLabel(names=aa_categories_unique,)),
|
| 34 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
obligations.py
DELETED
|
@@ -1,200 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
from config import LANGUAGE
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
cost_type = ["no_cost", "adm_cost", "direct_cost", "other_cost"]
|
| 7 |
-
cost_type_ES = ["sin_costo", "costo_adm", "costo_directo", "otro_costo"]
|
| 8 |
-
cost_type_PT = ["sem_custo", "custo_adm", "custo_direto", "outro_custo"]
|
| 9 |
-
|
| 10 |
-
affected_entity = ["no_affected_ent", "companies", "citizens", "public_adm"]
|
| 11 |
-
affected_entity_ES = ["ent_no_afectada",
|
| 12 |
-
"empresas", "ciudadanos", "adm_publica"]
|
| 13 |
-
affected_entity_PT = ["ent_nao_afetada", "empresas", "cidadaos", "adm_publica"]
|
| 14 |
-
|
| 15 |
-
# [i] -
|
| 16 |
-
# [i] IO Categories -
|
| 17 |
-
# [i] -
|
| 18 |
-
|
| 19 |
-
io_categories_PT = [
|
| 20 |
-
"prestacao_info_empresarial_e_fiscal",
|
| 21 |
-
"pedidos_de_licencas_e_outros",
|
| 22 |
-
"registos_e_notificacoes",
|
| 23 |
-
"candidatura_a_subsidios_e_outros",
|
| 24 |
-
"disponibilizacao_de_manuais_e_outros",
|
| 25 |
-
"cooperacao_com_auditorias_e_outros",
|
| 26 |
-
"prestacao_info_a_consumidores",
|
| 27 |
-
"outras_ois"
|
| 28 |
-
],
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
io_categories_ES = [
|
| 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 |
-
# [i] -
|
| 43 |
-
# [i] IO Categories Unique -
|
| 44 |
-
# [i] -
|
| 45 |
-
|
| 46 |
-
aa_categories_unique_PT = [
|
| 47 |
-
"familiarizacao_com_oi",
|
| 48 |
-
"recolha_e_organizacao_de_info",
|
| 49 |
-
"processamento_de_info",
|
| 50 |
-
"tempos_de_espera",
|
| 51 |
-
"deslocacoes",
|
| 52 |
-
"submissao_de_info",
|
| 53 |
-
"preservacao_de_info"
|
| 54 |
-
]
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
aa_categories_unique_ES = [
|
| 58 |
-
"familiarizacion_con_OI"
|
| 59 |
-
"recoleccion_y_organizacion_de_informacion"
|
| 60 |
-
"procesamiento_de_informacion"
|
| 61 |
-
"tiempos_de_espera"
|
| 62 |
-
"desplazamientos"
|
| 63 |
-
"envio_de_informacion"
|
| 64 |
-
"preservacion_de_informacion"
|
| 65 |
-
]
|
| 66 |
-
|
| 67 |
-
# [i] -
|
| 68 |
-
# [i] AA Categories -
|
| 69 |
-
# [i] -
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
aa_categories_PT = [
|
| 73 |
-
"aa_1_familiarizacao_com_oi",
|
| 74 |
-
"aa_1_recolha_e_organizacao_de_info",
|
| 75 |
-
"aa_1_processamento_de_info",
|
| 76 |
-
"aa_1_tempos_de_espera",
|
| 77 |
-
"aa_1_deslocacoes",
|
| 78 |
-
"aa_1_submissao_de_info",
|
| 79 |
-
"aa_1_preservacao_de_info",
|
| 80 |
-
"aa_2_familiarizacao_com_oi",
|
| 81 |
-
"aa_2_recolha_e_organizacao_de_info",
|
| 82 |
-
"aa_2_processamento_de_info",
|
| 83 |
-
"aa_2_tempos_de_espera",
|
| 84 |
-
"aa_2_deslocacoes",
|
| 85 |
-
"aa_2_submissao_de_info",
|
| 86 |
-
"aa_2_preservacao_de_info",
|
| 87 |
-
"aa_3_familiarizacao_com_oi",
|
| 88 |
-
"aa_3_recolha_e_organizacao_de_info",
|
| 89 |
-
"aa_3_processamento_de_info",
|
| 90 |
-
"aa_3_tempos_de_espera",
|
| 91 |
-
"aa_3_deslocacoes",
|
| 92 |
-
"aa_3_submissao_de_info",
|
| 93 |
-
"aa_3_preservacao_de_info",
|
| 94 |
-
"aa_4_familiarizacao_com_oi",
|
| 95 |
-
"aa_4_recolha_e_organizacao_de_info",
|
| 96 |
-
"aa_4_processamento_de_info",
|
| 97 |
-
"aa_4_tempos_de_espera",
|
| 98 |
-
"aa_4_deslocacoes",
|
| 99 |
-
"aa_4_submissao_de_info",
|
| 100 |
-
"aa_4_preservacao_de_info",
|
| 101 |
-
"aa_5_familiarizacao_com_oi",
|
| 102 |
-
"aa_5_recolha_e_organizacao_de_info",
|
| 103 |
-
"aa_5_processamento_de_info",
|
| 104 |
-
"aa_5_tempos_de_espera",
|
| 105 |
-
"aa_5_deslocacoes",
|
| 106 |
-
"aa_5_submissao_de_info",
|
| 107 |
-
"aa_5_preservacao_de_info",
|
| 108 |
-
"aa_6_familiarizacao_com_oi",
|
| 109 |
-
"aa_6_recolha_e_organizacao_de_info",
|
| 110 |
-
"aa_6_processamento_de_info",
|
| 111 |
-
"aa_6_tempos_de_espera",
|
| 112 |
-
"aa_6_deslocacoes",
|
| 113 |
-
"aa_6_submissao_de_info",
|
| 114 |
-
"aa_6_preservacao_de_info",
|
| 115 |
-
"aa_7_familiarizacao_com_oi",
|
| 116 |
-
"aa_7_recolha_e_organizacao_de_info",
|
| 117 |
-
"aa_7_processamento_de_info",
|
| 118 |
-
"aa_7_tempos_de_espera",
|
| 119 |
-
"aa_7_deslocacoes",
|
| 120 |
-
"aa_7_submissao_de_info",
|
| 121 |
-
"aa_7_preservacao_de_info"
|
| 122 |
-
]
|
| 123 |
-
|
| 124 |
-
aa_categories_ES = [
|
| 125 |
-
"aa_1_familiarizacion_con_OI"
|
| 126 |
-
"aa_1_recoleccion_y_organizacion_de_informacion"
|
| 127 |
-
"aa_1_procesamiento_de_informacion"
|
| 128 |
-
"aa_1_tiempos_de_espera"
|
| 129 |
-
"aa_1_desplazamientos"
|
| 130 |
-
"aa_1_envio_de_informacion"
|
| 131 |
-
"aa_1_preservacion_de_informacion"
|
| 132 |
-
"aa_2_familiarizacion_con_OI"
|
| 133 |
-
"aa_2_recoleccion_y_organizacion_de_informacion"
|
| 134 |
-
"aa_2_procesamiento_de_informacion"
|
| 135 |
-
"aa_2_tiempos_de_espera"
|
| 136 |
-
"aa_2_desplazamientos"
|
| 137 |
-
"aa_2_envio_de_informacion"
|
| 138 |
-
"aa_2_preservacion_de_informacion"
|
| 139 |
-
"aa_3_familiarizacion_con_OI"
|
| 140 |
-
"aa_3_recoleccion_y_organizacion_de_informacion"
|
| 141 |
-
"aa_3_procesamiento_de_informacion"
|
| 142 |
-
"aa_3_tiempos_de_espera"
|
| 143 |
-
"aa_3_desplazamientos"
|
| 144 |
-
"aa_3_envio_de_informacion"
|
| 145 |
-
"aa_3_preservacion_de_informacion"
|
| 146 |
-
"aa_4_familiarizacion_con_OI"
|
| 147 |
-
"aa_4_recoleccion_y_organizacion_de_informacion"
|
| 148 |
-
"aa_4_procesamiento_de_informacion"
|
| 149 |
-
"aa_4_tiempos_de_espera"
|
| 150 |
-
"aa_4_desplazamientos"
|
| 151 |
-
"aa_4_envio_de_informacion"
|
| 152 |
-
"aa_4_preservacion_de_informacion"
|
| 153 |
-
"aa_5_familiarizacion_con_OI"
|
| 154 |
-
"aa_5_recoleccion_y_organizacion_de_informacion"
|
| 155 |
-
"aa_5_procesamiento_de_informacion"
|
| 156 |
-
"aa_5_tiempos_de_espera"
|
| 157 |
-
"aa_5_desplazamientos"
|
| 158 |
-
"aa_5_envio_de_informacion"
|
| 159 |
-
"aa_5_preservacion_de_informacion"
|
| 160 |
-
"aa_6_familiarizacion_con_OI"
|
| 161 |
-
"aa_6_recoleccion_y_organizacion_de_informacion"
|
| 162 |
-
"aa_6_procesamiento_de_informacion"
|
| 163 |
-
"aa_6_tiempos_de_espera"
|
| 164 |
-
"aa_6_desplazamientos"
|
| 165 |
-
"aa_6_envio_de_informacion"
|
| 166 |
-
"aa_6_preservacion_de_informacion"
|
| 167 |
-
"aa_7_familiarizacion_con_OI"
|
| 168 |
-
"aa_7_recoleccion_y_organizacion_de_informacion"
|
| 169 |
-
"aa_7_procesamiento_de_informacion"
|
| 170 |
-
"aa_7_tiempos_de_espera"
|
| 171 |
-
"aa_7_desplazamientos"
|
| 172 |
-
"aa_7_envio_de_informacion"
|
| 173 |
-
"aa_7_preservacion_de_informacion"
|
| 174 |
-
]
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
io_categories = [],
|
| 178 |
-
aa_categories_unique = []
|
| 179 |
-
aa_categories = []
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
if LANGUAGE == "ES":
|
| 183 |
-
io_categories = io_categories_ES,
|
| 184 |
-
aa_categories_unique = aa_categories_unique_ES
|
| 185 |
-
aa_categories = aa_categories_ES
|
| 186 |
-
cost_type = cost_type_ES
|
| 187 |
-
affected_entity = affected_entity_ES
|
| 188 |
-
elif LANGUAGE == "PT":
|
| 189 |
-
io_categories = io_categories_PT,
|
| 190 |
-
aa_categories_unique = aa_categories_unique_PT
|
| 191 |
-
aa_categories = aa_categories_PT
|
| 192 |
-
cost_type = cost_type_PT
|
| 193 |
-
affected_entity = affected_entity_PT
|
| 194 |
-
|
| 195 |
-
urls = {
|
| 196 |
-
"raw": "./data/raw.parquet",
|
| 197 |
-
"sentences_unlabeled": "./data/unlabeled.parquet",
|
| 198 |
-
"sentences_labeled_train": "./data/labeled_train.parquet",
|
| 199 |
-
"sentences_labeled_test": "./data/labeled_test.parquet",
|
| 200 |
-
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
py_legislation_metadata.py
DELETED
|
@@ -1,69 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
import textwrap
|
| 4 |
-
import datasets
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
# [i] -
|
| 10 |
-
# [i] GENERAL DESCRIPTIONS -
|
| 11 |
-
# [i] -
|
| 12 |
-
|
| 13 |
-
PY_LEGISLATION_METADATA = {
|
| 14 |
-
"citation" : """\
|
| 15 |
-
@InProceedings{
|
| 16 |
-
huggingface:dataset,
|
| 17 |
-
title = {Paraguay Legislation Dataset},
|
| 18 |
-
author={Peres, Fernando; Costa, Victor},
|
| 19 |
-
year={2023}
|
| 20 |
-
}
|
| 21 |
-
""",
|
| 22 |
-
|
| 23 |
-
"description" :textwrap.dedent("""\
|
| 24 |
-
Dataset for researching - NLP techniques on PARAGUAY legislation.
|
| 25 |
-
"""),
|
| 26 |
-
|
| 27 |
-
"homepage" : "https://www.leyes.com.py/",
|
| 28 |
-
|
| 29 |
-
"license" : "apache-2.0",
|
| 30 |
-
|
| 31 |
-
"urls" : {
|
| 32 |
-
"raw": "./data/0_raw/raw.parquet",
|
| 33 |
-
"sentences_unlabeled": "./data/1_sentences_unlabeled/unlabeled.parquet",
|
| 34 |
-
"sentences_labeled": "./data/2_sentences_labeled/labeled.parquet",
|
| 35 |
-
},
|
| 36 |
-
|
| 37 |
-
"raw-description" : textwrap.dedent("""
|
| 38 |
-
Data extracted from the sources files (URls, PDFs and Word files) without any transformation or sentence splitter. It can be helpful because you can access the raw data extracted from the seeds (PDFs and Word files) and apply other preprocessing tasks from this point to prepare the data without returning to extract texts from source files.
|
| 39 |
-
"""),
|
| 40 |
-
|
| 41 |
-
"sentences-unlabeled-description" : textwrap.dedent("""
|
| 42 |
-
Unlabeled corpora of Paraguay legislation. This data is prepared to be labeled by the experts. Each instance of the dataset represents a specific text passage, split by its original formatting extracted from raw text (from original documents)
|
| 43 |
-
|
| 44 |
-
Each observation of the dataset represents a specific text passage.
|
| 45 |
-
"""),
|
| 46 |
-
|
| 47 |
-
"sentences-labeled-description" : textwrap.dedent("""
|
| 48 |
-
The labeled data is the ground truth data used to train the models. This data is annotated by legal experts indicating the existence of administrative costs (and other types) in the legislation.
|
| 49 |
-
|
| 50 |
-
Each observation of the dataset represents a specific text passage.
|
| 51 |
-
"""),
|
| 52 |
-
}
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
x = {
|
| 56 |
-
"config_names" : {
|
| 57 |
-
"raw": {
|
| 58 |
-
"description" : "",
|
| 59 |
-
"features" : {
|
| 60 |
-
"source_id": datasets.Value(dtype="int64"),
|
| 61 |
-
"doc_source_id": datasets.Value(dtype="int64"),
|
| 62 |
-
"document": datasets.Value(dtype="string"),
|
| 63 |
-
"text": datasets.Value(dtype="string"),
|
| 64 |
-
}
|
| 65 |
-
}
|
| 66 |
-
}
|
| 67 |
-
}
|
| 68 |
-
|
| 69 |
-
# x["config_names"]["raw"]["description"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|