fernando-peres commited on
Commit
56c32e5
·
1 Parent(s): 2d13fb6

resolving card bugs

Browse files
Files changed (1) hide show
  1. py_legislation.py +8 -1
py_legislation.py CHANGED
@@ -304,7 +304,7 @@ class PY_legislation(datasets.GeneratorBasedBuilder):
304
  name=datasets.Split.TRAIN,
305
  gen_kwargs={
306
  # rt_train # downloaded_files["raw_text"],
307
- "filepath": rt_train #_metadata["urls"]["raw_text"]
308
  },
309
  ),
310
 
@@ -346,6 +346,13 @@ class PY_legislation(datasets.GeneratorBasedBuilder):
346
  The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
347
  Obs: method parameters are unpacked from `gen_kwargs` as given in `_split_generators`.
348
  """
 
 
 
 
 
 
 
349
  pq_table = pq.read_table(filepath)
350
  for i in range(len(pq_table)):
351
  yield i, {
 
304
  name=datasets.Split.TRAIN,
305
  gen_kwargs={
306
  # rt_train # downloaded_files["raw_text"],
307
+ "filepath": rt_train # _metadata["urls"]["raw_text"]
308
  },
309
  ),
310
 
 
346
  The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
347
  Obs: method parameters are unpacked from `gen_kwargs` as given in `_split_generators`.
348
  """
349
+ # Ensure that the filepath is an absolute local file path
350
+ filepath = os.path.abspath(filepath)
351
+
352
+ # Check if the file exists
353
+ if not os.path.exists(filepath):
354
+ raise FileNotFoundError(f"File not found: {filepath}")
355
+
356
  pq_table = pq.read_table(filepath)
357
  for i in range(len(pq_table)):
358
  yield i, {