JP-SystemsX
commited on
Commit
•
95feafb
1
Parent(s):
54222d9
Unlocked Remaining Sectors
Browse files- super_eurlex.py +282 -38
super_eurlex.py
CHANGED
@@ -23,6 +23,7 @@ import numpy as np
|
|
23 |
import pandas as pd
|
24 |
|
25 |
import datasets
|
|
|
26 |
|
27 |
|
28 |
# TODO: Add BibTeX citation
|
@@ -47,28 +48,280 @@ _URLS = {
|
|
47 |
"second_domain": "https://huggingface.co/great-new-dataset-second_domain.zip",
|
48 |
}
|
49 |
AVAILABLE_LANGUAGES=['DE']#, 'EN'
|
50 |
-
SECTORS=['
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
}
|
|
|
|
|
70 |
SECTOR_DESCRIPTIONS={
|
71 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
|
74 |
|
@@ -173,23 +426,13 @@ class SuperEurlex(datasets.GeneratorBasedBuilder):
|
|
173 |
def _generate_examples(self, text, meta, sector, language, split):
|
174 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
175 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
176 |
-
|
177 |
-
print(meta)
|
178 |
-
print(sector)
|
179 |
-
print(split)
|
180 |
-
print(sector)
|
181 |
-
|
182 |
-
print("Reading Text Data...")
|
183 |
-
text_data = pd.read_parquet(text)#, lines=True)
|
184 |
text_data['celex_id'] = text_data['celex_id'].apply(lambda x: str(x.tolist()[0]) if isinstance(x,list) else x)
|
185 |
-
|
186 |
-
meta_data = pd.read_parquet(meta)#, lines=True)
|
187 |
meta_data['celex_id'] = meta_data['celex_id'].apply(lambda x: str(x.tolist()[0]) if isinstance(x, np.ndarray) else x)
|
188 |
-
print("Combining Text & Meta Data...")
|
189 |
combined_data = pd.merge(text_data, meta_data, on='celex_id')
|
190 |
-
print("Converting To final dataset...")
|
191 |
dataset = datasets.Dataset.from_pandas(combined_data)
|
192 |
-
dataset = dataset.remove_columns('__index_level_0__')
|
193 |
for i, sample in enumerate(dataset):
|
194 |
yield i, sample
|
195 |
|
@@ -200,8 +443,9 @@ if __name__ == '__main__':
|
|
200 |
import datasets as ds
|
201 |
import sys
|
202 |
print(sys.argv[0])
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
23 |
import pandas as pd
|
24 |
|
25 |
import datasets
|
26 |
+
from tqdm.auto import tqdm
|
27 |
|
28 |
|
29 |
# TODO: Add BibTeX citation
|
|
|
48 |
"second_domain": "https://huggingface.co/great-new-dataset-second_domain.zip",
|
49 |
}
|
50 |
AVAILABLE_LANGUAGES=['DE']#, 'EN'
|
51 |
+
SECTORS=['0', '1', '2', '3', '4', '5', '6', '8', '9', 'C', 'E']
|
52 |
+
|
53 |
+
# Features to override the standard most Features were scrapped as a sequence
|
54 |
+
# of strings with only the following exceptions
|
55 |
+
FEATURES = {
|
56 |
+
'celex_id': datasets.Value("string"),
|
57 |
+
'current_consolidated_version': datasets.Sequence(datasets.Value("string")),
|
58 |
+
'customs_duties_authorisation_to_defer_application_of_cct': datasets.Sequence(datasets.Value("string")),
|
59 |
+
'customs_duties_community_tariff_quotas': datasets.Sequence(datasets.Value("string")),
|
60 |
+
'customs_duties_suspensions': datasets.Sequence(datasets.Value("string")),
|
61 |
+
'directory_code': datasets.Sequence(datasets.Value("string")),
|
62 |
+
'eurovoc': datasets.Sequence(datasets.Value("string")),
|
63 |
+
'form': datasets.Sequence(datasets.Value("string")),
|
64 |
+
'harmonisation_of_customs_law_community_transit': datasets.Sequence(datasets.Value("string")),
|
65 |
+
'harmonisation_of_customs_law_customs_territory': datasets.Sequence(datasets.Value("string")),
|
66 |
+
'harmonisation_of_customs_law_origin_of_goods': datasets.Sequence(datasets.Value("string")),
|
67 |
+
'harmonisation_of_customs_law_value_for_customs_purposes': datasets.Sequence(datasets.Value("string")),
|
68 |
+
'harmonisation_of_customs_law_various': datasets.Sequence(datasets.Value("string")),
|
69 |
+
'subject_matter': datasets.Sequence(datasets.Value("string")),
|
70 |
+
'text_cleaned': datasets.Value("string"),
|
71 |
+
'text_html_cleaned': datasets.Value("string"),
|
72 |
+
'text_html_raw': datasets.Value("string"),
|
73 |
+
'02.40.10.20_customs_union_and_free_movement_of_goods_/_specific_customs_rules_/_movement_of_goods_/_extra-community_trade_efta_agreements':datasets.Sequence(datasets.Value("string")),
|
74 |
+
'13.20.40.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_textiles':datasets.Sequence(datasets.Value("string")),
|
75 |
+
'13.20.60.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_information_technology,_telecommunications_and_data-processing':datasets.Sequence(datasets.Value("string")),
|
76 |
+
'13.10.30.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development':datasets.Sequence(datasets.Value("string")),
|
77 |
+
'13.10.30.10_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_general_principles': datasets.Sequence(datasets.Value("string")),
|
78 |
+
'13.30.19.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_fertilisers': datasets.Sequence(datasets.Value("string")),
|
79 |
+
'13.10.30.20_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_research_sectors': datasets.Sequence(datasets.Value("string")),
|
80 |
+
}
|
81 |
+
FEATURES_IN_SECTOR={
|
82 |
+
'0':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form'],
|
83 |
+
'1':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form',
|
84 |
+
'subject_matter', 'current_consolidated_version',
|
85 |
+
'harmonisation_of_customs_law_community_transit', 'harmonisation_of_customs_law_customs_territory',
|
86 |
+
'harmonisation_of_customs_law_value_for_customs_purposes', 'directory_code', 'eurovoc',
|
87 |
+
'customs_duties_community_tariff_quotas', 'customs_duties_community_tariff_quotas',
|
88 |
+
'customs_duties_authorisation_to_defer_application_of_cct', 'harmonisation_of_customs_law_various',
|
89 |
+
'customs_duties_suspensions'],
|
90 |
+
'2':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned',
|
91 |
+
'harmonisation_of_customs_law_origin_of_goods', 'form', 'directory_code',
|
92 |
+
'subject_matter', 'eurovoc', 'harmonisation_of_customs_law_community_transit',
|
93 |
+
'02.40.10.20_customs_union_and_free_movement_of_goods_/_specific_customs_rules_/_movement_of_goods_/_extra-community_trade_efta_agreements',
|
94 |
+
'current_consolidated_version',
|
95 |
+
'13.20.40.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_textiles',
|
96 |
+
'13.20.60.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_information_technology,_telecommunications_and_data-processing',
|
97 |
+
'harmonisation_of_customs_law_various', 'customs_duties_community_tariff_quotas',
|
98 |
+
'13.10.30.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development',
|
99 |
+
'13.10.30.10_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_general_principles',
|
100 |
+
'13.30.19.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_fertilisers',
|
101 |
+
'13.10.30.20_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_research_sectors',
|
102 |
+
'cct_franchise','13.20.20.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_shipbuilding',
|
103 |
+
'customs_duties_suspensions', 'latest_consolidated_version',
|
104 |
+
'cct_derogations',
|
105 |
+
'13.40.00.00_industrial_policy_and_internal_market_/_internal_market_policy_relating_to_undertakings',
|
106 |
+
'13.20.10.20_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_other_measures_relating_to_iron_and_steel',
|
107 |
+
'13.20.10.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry',
|
108 |
+
'13.30.99.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_other_sectors_for_approximation_of_laws',
|
109 |
+
'13.20.30.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_aeronautical_industry',
|
110 |
+
'13.30.16.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_cosmetics',
|
111 |
+
'13.30.15.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_proprietary_medicinal_products',
|
112 |
+
'13.30.10.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_motor_vehicles',
|
113 |
+
'common_customs_tariff_temporary_importation'
|
114 |
+
],
|
115 |
+
'3':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form', 'cct_derogations',
|
116 |
+
'directory_code', 'subject_matter','eurovoc', 'cct_franchise',
|
117 |
+
'harmonisation_of_customs_law_various', 'latest_consolidated_version',
|
118 |
+
'02.40.10.20_customs_union_and_free_movement_of_goods_/_specific_customs_rules_/_movement_of_goods_/_extra-community_trade_efta_agreements',
|
119 |
+
'harmonisation_of_customs_law_community_transit',
|
120 |
+
'current_consolidated_version',
|
121 |
+
'harmonisation_of_customs_law_value_for_customs_purposes',
|
122 |
+
'harmonisation_of_customs_law_origin_of_goods',
|
123 |
+
'harmonisation_of_customs_law_inward_processing',
|
124 |
+
'common_customs_tariff_temporary_importation',
|
125 |
+
'customs_duties_suspensions',
|
126 |
+
'13.30.14.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs',
|
127 |
+
'harmonisation_of_customs_law_warehouses,_free_zones',
|
128 |
+
'customs_duties_community_tariff_quotas',
|
129 |
+
'13.20.10.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry',
|
130 |
+
'13.10.20.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_programmes_and_statistics',
|
131 |
+
'13.10.00.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research',
|
132 |
+
'13.20.40.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_textiles',
|
133 |
+
'13.20.50.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_leather,_hides,_skins_and_footwear',
|
134 |
+
'13.20.60.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_information_technology,_telecommunications_and_data-processing',
|
135 |
+
'13.20.10.20_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_other_measures_relating_to_iron_and_steel',
|
136 |
+
'13.20.70.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_other_industrial_sectors',
|
137 |
+
'harmonisation_of_customs_law_customs_territory',
|
138 |
+
'customs_duties_authorisation_to_defer_application_of_cct',
|
139 |
+
'13.30.15.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_proprietary_medicinal_products',
|
140 |
+
'13.20.20.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_shipbuilding',
|
141 |
+
'13.30.19.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_fertilisers',
|
142 |
+
'13.30.17.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_textiles',
|
143 |
+
'13.10.10.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_general',
|
144 |
+
'13.10.30.10_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_general_principles',
|
145 |
+
'13.40.00.00_industrial_policy_and_internal_market_/_internal_market_policy_relating_to_undertakings',
|
146 |
+
'13.30.11.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_agricultural_and_forestry_tractors',
|
147 |
+
'13.30.99.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_other_sectors_for_approximation_of_laws',
|
148 |
+
'13.10.30.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development',
|
149 |
+
'13.10.30.20_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_research_sectors',
|
150 |
+
'13.30.18.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_dangerous_substances',
|
151 |
+
'13.30.16.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_cosmetics',
|
152 |
+
'13.30.10.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_motor_vehicles',
|
153 |
+
'customs_duties_national_tariff_quotas',
|
154 |
+
'13.30.13.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_electrical_material',
|
155 |
+
'13.30.14.30_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs_/_other_provisions',
|
156 |
+
'13.30.14.20_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs_/_preservatives',
|
157 |
+
'customs_duties_speed-up_decisions',
|
158 |
+
'13.30.05.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_general,_programmes',
|
159 |
+
'13.30.14.10_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs_/_colouring_matters',
|
160 |
+
'13.30.00.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws',
|
161 |
+
'13.20.10.10_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_competition_prices_and_other_conditions_of_sale',
|
162 |
+
'13.30.12.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_metrology',
|
163 |
+
'12.20.20.00_energy_/_coal_/_competition_rates_and_other_conditions_of_sale',
|
164 |
+
'13.20.30.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_aeronautical_industry',
|
165 |
+
'13.20.00.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations'
|
166 |
+
],
|
167 |
+
'4':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form', 'eurovoc',
|
168 |
+
'subject_matter', 'current_consolidated_version', 'directory_code',
|
169 |
+
'13.30.10.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_motor_vehicles',
|
170 |
+
'13.30.11.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_agricultural_and_forestry_tractors',
|
171 |
+
'13.30.05.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_general,_programmes',
|
172 |
+
'latest_consolidated_version', 'cct_derogations',
|
173 |
+
'customs_duties_suspensions', 'customs_duties_speed-up_decisions',
|
174 |
+
'13.20.10.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry',
|
175 |
+
'customs_duties_community_tariff_quotas',
|
176 |
+
'harmonisation_of_customs_law_origin_of_goods',
|
177 |
+
'02.40.10.20_customs_union_and_free_movement_of_goods_/_specific_customs_rules_/_movement_of_goods_/_extra-community_trade_efta_agreements',
|
178 |
+
'13.20.10.20_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_other_measures_relating_to_iron_and_steel',
|
179 |
+
'harmonisation_of_customs_law_value_for_customs_purposes',
|
180 |
+
'13.20.60.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_information_technology,_telecommunications_and_data-processing',
|
181 |
+
'harmonisation_of_customs_law_community_transit',
|
182 |
+
'harmonisation_of_customs_law_various',
|
183 |
+
'13.10.30.10_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_general_principles',
|
184 |
+
'13.10.20.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_programmes_and_statistics',
|
185 |
+
'13.30.99.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_other_sectors_for_approximation_of_laws'],
|
186 |
+
'5':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form', 'directory_code', 'subject_matter', 'eurovoc',
|
187 |
+
'13.30.05.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_general,_programmes',
|
188 |
+
'13.10.30.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development',
|
189 |
+
'13.10.30.20_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_research_sectors',
|
190 |
+
'13.30.14.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs',
|
191 |
+
'13.20.60.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_information_technology,_telecommunications_and_data-processing',
|
192 |
+
'13.30.99.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_other_sectors_for_approximation_of_laws',
|
193 |
+
'13.10.10.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_general',
|
194 |
+
'13.40.00.00_industrial_policy_and_internal_market_/_internal_market_policy_relating_to_undertakings',
|
195 |
+
'13.30.16.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_cosmetics',
|
196 |
+
'13.10.20.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_programmes_and_statistics',
|
197 |
+
'13.30.10.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_motor_vehicles',
|
198 |
+
'13.20.70.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_other_industrial_sectors',
|
199 |
+
'13.20.10.20_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_other_measures_relating_to_iron_and_steel',
|
200 |
+
'13.20.00.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations',
|
201 |
+
'13.10.30.10_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_general_principles',
|
202 |
+
'13.20.10.10_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_competition_prices_and_other_conditions_of_sale',
|
203 |
+
'13.30.18.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_dangerous_substances',
|
204 |
+
'13.30.00.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws',
|
205 |
+
'13.30.13.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_electrical_material',
|
206 |
+
'13.30.12.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_metrology',
|
207 |
+
'13.30.15.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_proprietary_medicinal_products',
|
208 |
+
'13.20.50.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_leather,_hides,_skins_and_footwear',
|
209 |
+
'13.20.10.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry',
|
210 |
+
'13.30.17.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_textiles',
|
211 |
+
'13.10.00.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research',
|
212 |
+
'13.20.30.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_aeronautical_industry',
|
213 |
+
'13.30.11.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_agricultural_and_forestry_tractors',
|
214 |
+
'13.30.19.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_fertilisers',
|
215 |
+
'13.30.14.30_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs_/_other_provisions',
|
216 |
+
'customs_duties_suspensions', 'customs_duties_community_tariff_quotas',
|
217 |
+
'02.40.10.20_customs_union_and_free_movement_of_goods_/_specific_customs_rules_/_movement_of_goods_/_extra-community_trade_efta_agreements',
|
218 |
+
'cct_derogations', 'harmonisation_of_customs_law_various',
|
219 |
+
'customs_duties_national_tariff_quotas',
|
220 |
+
'harmonisation_of_customs_law_origin_of_goods',
|
221 |
+
'13.20.20.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_shipbuilding',
|
222 |
+
'cct_franchise',
|
223 |
+
'customs_duties_authorisation_to_defer_application_of_cct',
|
224 |
+
'13.20.40.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_textiles',
|
225 |
+
'common_customs_tariff_temporary_importation',
|
226 |
+
'12.20.20.00_energy_/_coal_/_competition_rates_and_other_conditions_of_sale',
|
227 |
+
'harmonisation_of_customs_law_community_transit',
|
228 |
+
'harmonisation_of_customs_law_inward_processing',
|
229 |
+
'harmonisation_of_customs_law_warehouses,_free_zones',
|
230 |
+
'harmonisation_of_customs_law_value_for_customs_purposes',
|
231 |
+
'harmonisation_of_customs_law_customs_territory',
|
232 |
+
'current_consolidated_version'],
|
233 |
+
'6':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form',
|
234 |
+
'case-law_directory_code_before_lisbon', 'subject_matter', 'b-03.07.01_european_community_eec/ec_/_agriculture_/_structural_policy_/_structural_reform_of_agriculture_joint_action',
|
235 |
+
'b-03.03.07_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_import_and_export_licences_and_advance-fixing_certificates',
|
236 |
+
'b-03.03.06_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_export_refunds',
|
237 |
+
'b-04.06.04.02_european_community_eec/ec_/_eec/ec_-_free_movement_of_persons_and_services_*_free_movement_of_persons_and_services_/_social_security_for_workers_/_social_security_for_workers_-_old_age_and_death_*_old_age_and_death_/_calculation_of_benefits_provisions_against_overlapping',
|
238 |
+
'b-02.04.02.01_european_community_eec/ec_/_eec/ec_-_free_movement_of_goods_*_free_movement_of_goods_/_trade_with_non-member_countries_/_common_customs_tariff_/_common_customs_tariff_-_interpretation_of_tariff_headings_and_classification_of_goods_principles_and_procedures_*_interpretation_of_tariff_headings_and_classification_of_goods_principles_and_procedures',
|
239 |
+
'b-03.03.08_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_deposit_systems',
|
240 |
+
'b-03.03.03_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_prohibition_of_discrimination',
|
241 |
+
'b-07.02.04.02_european_community_eec/ec_/_eec/ec_-_competition_*_competition_/_dominant_position_/_abuse_of_a_dominant_position_/_dominant_position_-_abuse_of_a_dominant_position_examples_*_examples_of_abuse',
|
242 |
+
'b-19.07.01_european_community_eec/ec_/_eec/ec_-_legal_proceedings_*_legal_proceedings_/_ancillary_procedures_and_applications_/_application_for_interim_measures_suspension_of_operation_of_the_contested_measure_and_other_interim_measures',
|
243 |
+
'b-03.03.02_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_common_organizations_and_intervention_by_the_member_states',
|
244 |
+
'b-03.03.01_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_national_market_organizations_and_common_organizations',
|
245 |
+
'eurovoc',
|
246 |
+
'b-07.01.01.04_european_community_eec/ec_/_eec/ec_-_competition_*_competition_/_agreements,_decisions_and_concerted_practices_/_prohibition_of_agreements,_decisions_and_concerted_practices_/_agreements_that_are_incompatible_with_the_common_market_examples',
|
247 |
+
'b-03.03.04_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_agricultural_prices',
|
248 |
+
'b-03.03.05_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_import_levies',
|
249 |
+
'b-03.03.09_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms_/_intervention_mechanisms',
|
250 |
+
'b-07.03.02.02_european_community_eec/ec_/_eec/ec_-_competition_*_competition_/_implementation_of_the_competition_rules_/_procedure_for_the_application_of_the_competition_rules_by_the_commission_/_procedure_for_the_application_of_the_competition_rules_-_termination_of_infringements_powers_of_the_commission_*_termination_of_infringements_powers_of_the_commission',
|
251 |
+
'directory_code',
|
252 |
+
'13.30.14.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs',
|
253 |
+
'13.10.30.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development',
|
254 |
+
'b-07.05.04.01_european_community_eec/ec_/_eec/ec_-_competition_*_competition_/_concentrations_between_undertakings_/_examination_by_the_commission_/_initiation_of_proceedings_notification_and_complaints'],
|
255 |
+
'7':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form', 'transposed_legal_acts'],
|
256 |
+
'8':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form',
|
257 |
+
'case-law_directory_code_before_lisbon', 'subject_matter',
|
258 |
+
'b-03.03_european_community_eec/ec_/_agriculture_/_common_organization_of_the_markets_principles_and_mechanisms'],
|
259 |
+
'9':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form', 'eurovoc', 'subject_matter', 'directory_code',
|
260 |
+
'13.10.30.10_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_general_principles',
|
261 |
+
'13.30.99.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_other_sectors_for_approximation_of_laws',
|
262 |
+
'13.30.05.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_general,_programmes',
|
263 |
+
'13.30.00.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws',
|
264 |
+
'13.10.30.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development',
|
265 |
+
'13.10.10.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_general',
|
266 |
+
'13.20.60.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_information_technology,_telecommunications_and_data-processing',
|
267 |
+
'13.40.00.00_industrial_policy_and_internal_market_/_internal_market_policy_relating_to_undertakings',
|
268 |
+
'13.30.14.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs',
|
269 |
+
'13.30.10.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_motor_vehicles',
|
270 |
+
'13.30.15.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_proprietary_medicinal_products',
|
271 |
+
'13.30.13.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_electrical_material',
|
272 |
+
'13.30.18.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_dangerous_substances',
|
273 |
+
'13.10.00.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research',
|
274 |
+
'13.20.30.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_aeronautical_industry',
|
275 |
+
'customs_duties_suspensions',
|
276 |
+
'13.20.70.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_other_industrial_sectors',
|
277 |
+
'13.30.19.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_fertilisers',
|
278 |
+
'13.20.00.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations',
|
279 |
+
'13.10.20.00_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_programmes_and_statistics',
|
280 |
+
'13.20.40.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_textiles',
|
281 |
+
'harmonisation_of_customs_law_various',
|
282 |
+
'13.30.17.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_textiles',
|
283 |
+
'harmonisation_of_customs_law_origin_of_goods',
|
284 |
+
'13.30.16.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_cosmetics',
|
285 |
+
'13.30.14.10_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs_/_colouring_matters',
|
286 |
+
'13.30.14.20_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs_/_preservatives',
|
287 |
+
'13.10.30.20_industrial_policy_and_internal_market_/_industrial_policy_general,_programmes,_statistics_and_research_/_research_and_technological_development_/_research_sectors',
|
288 |
+
'13.20.20.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_shipbuilding',
|
289 |
+
'12.20.20.00_energy_/_coal_/_competition_rates_and_other_conditions_of_sale',
|
290 |
+
'13.20.10.10_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_competition_prices_and_other_conditions_of_sale',
|
291 |
+
'13.20.50.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_leather,_hides,_skins_and_footwear',
|
292 |
+
'13.30.12.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_metrology',
|
293 |
+
'13.20.10.20_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry_/_other_measures_relating_to_iron_and_steel',
|
294 |
+
'13.30.14.30_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs_/_other_provisions',
|
295 |
+
'cct_franchise', 'harmonisation_of_customs_law_community_transit',
|
296 |
+
'customs_duties_community_tariff_quotas',
|
297 |
+
'13.20.10.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_iron_and_steel_industry',
|
298 |
+
'13.30.11.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_agricultural_and_forestry_tractors',
|
299 |
+
'harmonisation_of_customs_law_warehouses,_free_zones'],
|
300 |
+
'C':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form', 'eurovoc'],
|
301 |
+
'E':['celex_id', 'text_html_raw', 'text_html_cleaned', 'text_cleaned', 'form', 'directory_code',
|
302 |
+
'subject_matter', 'eurovoc',
|
303 |
+
'13.30.14.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_foodstuffs',
|
304 |
+
'13.30.10.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_motor_vehicles',
|
305 |
+
'13.30.18.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_dangerous_substances',
|
306 |
+
'13.30.15.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_proprietary_medicinal_products',
|
307 |
+
'13.20.60.00_industrial_policy_and_internal_market_/_industrial_policy_sectoral_operations_/_information_technology,_telecommunications_and_data-processing',
|
308 |
+
'13.30.99.00_industrial_policy_and_internal_market_/_internal_market_approximation_of_laws_/_other_sectors_for_approximation_of_laws'],
|
309 |
}
|
310 |
+
AVAILABLE_FEATURES={sector: datasets.Features({feature:(FEATURES[feature] if feature in FEATURES else datasets.Sequence(datasets.Value("string"))) for feature in FEATURES_IN_SECTOR[sector]}) for sector in SECTORS}
|
311 |
+
|
312 |
SECTOR_DESCRIPTIONS={
|
313 |
+
'0':"",
|
314 |
+
'1':"",
|
315 |
+
'2':"",
|
316 |
+
'3':"",
|
317 |
+
'4':"",
|
318 |
+
'5':"",
|
319 |
+
'6':"",
|
320 |
+
'7':"",
|
321 |
+
'8':"",
|
322 |
+
'9':"",
|
323 |
+
'C':"",
|
324 |
+
'E':"",
|
325 |
}
|
326 |
|
327 |
|
|
|
426 |
def _generate_examples(self, text, meta, sector, language, split):
|
427 |
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
428 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
429 |
+
text_data = pd.read_parquet(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
430 |
text_data['celex_id'] = text_data['celex_id'].apply(lambda x: str(x.tolist()[0]) if isinstance(x,list) else x)
|
431 |
+
meta_data = pd.read_parquet(meta)
|
|
|
432 |
meta_data['celex_id'] = meta_data['celex_id'].apply(lambda x: str(x.tolist()[0]) if isinstance(x, np.ndarray) else x)
|
|
|
433 |
combined_data = pd.merge(text_data, meta_data, on='celex_id')
|
|
|
434 |
dataset = datasets.Dataset.from_pandas(combined_data)
|
435 |
+
dataset = dataset.remove_columns('__index_level_0__')
|
436 |
for i, sample in enumerate(dataset):
|
437 |
yield i, sample
|
438 |
|
|
|
443 |
import datasets as ds
|
444 |
import sys
|
445 |
print(sys.argv[0])
|
446 |
+
for sector in SECTORS:
|
447 |
+
for lang in AVAILABLE_LANGUAGES:
|
448 |
+
print(f'{sector}.{lang}')
|
449 |
+
dataset = ds.load_dataset(sys.argv[0],f'{sector}.{lang}')
|
450 |
+
print(dataset)
|
451 |
+
print('\n')
|