vsty commited on
Commit
fb70e7e
·
verified ·
1 Parent(s): fe11581

Update clef24_dataset_en.py

Browse files
Files changed (1) hide show
  1. clef24_dataset_en.py +9 -7
clef24_dataset_en.py CHANGED
@@ -1,7 +1,8 @@
1
  """Multilang Dataset loading script."""
2
 
3
- from datasets import DatasetDict, DatasetInfo, BuilderConfig, Version, GeneratorBasedBuilder
4
  from datasets import SplitGenerator, Split, Features, Value
 
5
 
6
  import os
7
 
@@ -22,16 +23,17 @@ _CITATION = """\
22
 
23
  _LICENSE = "Your dataset's license here."
24
 
25
- class MultilangDataset(GeneratorBasedBuilder):
26
  """A multilingual text dataset."""
27
 
28
  BUILDER_CONFIGS = [
29
- BuilderConfig(name="multilang_dataset", version=Version("1.0.0"), description="Multilingual dataset for text classification."),
30
  ]
31
 
32
- DEFAULT_CONFIG_NAME = "multilang_dataset" # Default configuration name.
33
 
34
  def _info(self):
 
35
  return DatasetInfo(
36
  description=_DESCRIPTION,
37
  features=Features({
@@ -45,7 +47,7 @@ class MultilangDataset(GeneratorBasedBuilder):
45
  license=_LICENSE,
46
  )
47
 
48
- def _split_generators(self, dl_manager):
49
  """Returns SplitGenerators."""
50
  # Assumes your dataset is located in "."
51
  data_dir = os.path.abspath("data")
@@ -62,7 +64,7 @@ class MultilangDataset(GeneratorBasedBuilder):
62
  for split in splits.keys()
63
  ]
64
 
65
- def _generate_examples(self, filepath, split):
66
  """Yields examples."""
67
  with open(filepath, encoding="utf-8") as f:
68
  for id_, row in enumerate(f):
@@ -73,4 +75,4 @@ class MultilangDataset(GeneratorBasedBuilder):
73
  "sentence_id": cols[0],
74
  "sentence": cols[1],
75
  "label": cols[2],
76
- }
 
1
  """Multilang Dataset loading script."""
2
 
3
+ from datasets import DatasetInfo, BuilderConfig, Version, GeneratorBasedBuilder, DownloadManager
4
  from datasets import SplitGenerator, Split, Features, Value
5
+ from typing import Generator, Tuple, Union
6
 
7
  import os
8
 
 
23
 
24
  _LICENSE = "Your dataset's license here."
25
 
26
+ class CLEF24EnData(GeneratorBasedBuilder):
27
  """A multilingual text dataset."""
28
 
29
  BUILDER_CONFIGS = [
30
+ BuilderConfig(name="clef_data_en", version=Version("1.0.0"), description="English dataset for check-worthy claim classification."),
31
  ]
32
 
33
+ DEFAULT_CONFIG_NAME = "clef_data_en" # Default configuration name.
34
 
35
  def _info(self):
36
+ """Construct the DatasetInfo object."""
37
  return DatasetInfo(
38
  description=_DESCRIPTION,
39
  features=Features({
 
47
  license=_LICENSE,
48
  )
49
 
50
+ def _split_generators(self, dl_manager: DownloadManager) -> list[SplitGenerator]:
51
  """Returns SplitGenerators."""
52
  # Assumes your dataset is located in "."
53
  data_dir = os.path.abspath("data")
 
64
  for split in splits.keys()
65
  ]
66
 
67
+ def _generate_examples(self, filepath: Union[str, os.PathLike], split: str) -> Generator[Tuple[str, dict], None, None]:
68
  """Yields examples."""
69
  with open(filepath, encoding="utf-8") as f:
70
  for id_, row in enumerate(f):
 
75
  "sentence_id": cols[0],
76
  "sentence": cols[1],
77
  "label": cols[2],
78
+ }