JP-SystemsX
commited on
Commit
•
54222d9
1
Parent(s):
676f80f
Minor Bugfix when loading DS
Browse files- super_eurlex.py +4 -2
super_eurlex.py
CHANGED
@@ -18,6 +18,8 @@
|
|
18 |
import csv
|
19 |
import json
|
20 |
import os
|
|
|
|
|
21 |
import pandas as pd
|
22 |
|
23 |
import datasets
|
@@ -179,10 +181,10 @@ class SuperEurlex(datasets.GeneratorBasedBuilder):
|
|
179 |
|
180 |
print("Reading Text Data...")
|
181 |
text_data = pd.read_parquet(text)#, lines=True)
|
182 |
-
text_data['celex_id'] = text_data['celex_id'].apply(lambda x: x[0] if isinstance(x,list) else x)
|
183 |
print("Reading Meta Data...")
|
184 |
meta_data = pd.read_parquet(meta)#, lines=True)
|
185 |
-
meta_data['celex_id'] = meta_data['celex_id'].apply(lambda x: x[0] if isinstance(x,
|
186 |
print("Combining Text & Meta Data...")
|
187 |
combined_data = pd.merge(text_data, meta_data, on='celex_id')
|
188 |
print("Converting To final dataset...")
|
|
|
18 |
import csv
|
19 |
import json
|
20 |
import os
|
21 |
+
|
22 |
+
import numpy as np
|
23 |
import pandas as pd
|
24 |
|
25 |
import datasets
|
|
|
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 |
print("Reading Meta Data...")
|
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...")
|