liyucheng commited on
Commit
2b56f67
·
1 Parent(s): 8ece08c

avoid using fixed configuration list

Browse files
Files changed (1) hide show
  1. bbc_alltime.py +5 -2
bbc_alltime.py CHANGED
@@ -1,5 +1,7 @@
1
  import datasets
2
  import json
 
 
3
 
4
  _CITATION = """\
5
  @misc{li2023estimating,
@@ -18,8 +20,9 @@ This dataset contains BBC News articles from 2017 to 2022. The articles are arra
18
 
19
  _HOMEPAGE = "https://github.com/liyucheng09/Contamination_Detector"
20
 
21
- _TIMES = ["2017-10", "2017-11", "2017-12", "2017-1", "2017-2", "2017-3", "2017-4", "2017-5", "2017-6", "2017-7", "2017-8", "2017-9", "2018-10", "2018-11", "2018-12", "2018-1", "2018-2", "2018-3", "2018-4", "2018-5", "2018-6", "2018-7", "2018-8", "2018-9", "2019-10", "2019-11", "2019-12", "2019-1", "2019-2", "2019-3", "2019-4", "2019-5", "2019-6", "2019-7", "2019-8", "2019-9", "2020-10", "2020-11", "2020-12", "2020-1", "2020-2", "2020-3", "2020-4", "2020-5", "2020-6", "2020-7", "2020-8", "2020-9", "2021-10", "2021-11", "2021-12", "2021-1", "2021-2", "2021-3", "2021-4", "2021-5", "2021-6", "2021-7", "2021-8", "2021-9", "2022-10", "2022-11", "2022-12", "2022-1", "2022-2", "2022-3", "2022-4", "2022-5", "2022-6", "2022-7", "2022-8", "2022-9", "all"]
22
-
 
23
 
24
  class Bbc_alltimes(datasets.GeneratorBasedBuilder):
25
 
 
1
  import datasets
2
  import json
3
+ import glob
4
+ import os
5
 
6
  _CITATION = """\
7
  @misc{li2023estimating,
 
20
 
21
  _HOMEPAGE = "https://github.com/liyucheng09/Contamination_Detector"
22
 
23
+ all_articles = glob.glob('articles/*.json')
24
+ file_names = [os.path.splitext(os.path.basename(path))[0] for path in all_articles]
25
+ _TIMES = file_names.sort() + ['all']
26
 
27
  class Bbc_alltimes(datasets.GeneratorBasedBuilder):
28