File size: 853 Bytes
82568a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import glob
import os

def read_folder(folder):
    folder_name = os.path.basename(folder)

    template = f"""- config_name: {folder_name}-corpus

  data_files:

  - split: train

    path: {folder_name}/corpus/*

- config_name: {folder_name}-queries

  data_files:"""
    
    for filepath in glob.glob(f"{folder}/queries/*.parquet"):
       template += f"""

  - split: {os.path.basename(filepath).split('.')[0]}

    path: {filepath}"""

    template += f"""

- config_name: {folder_name}-qrels

  data_files:"""
    for filepath in glob.glob(f"{folder}/qrels/*.parquet"):
       template += f"""

  - split: {os.path.basename(filepath).split('.')[0]}

    path: {filepath}"""
       
    return template




for filepath in sorted(glob.glob("*")):
    if os.path.isdir(filepath):
        print(read_folder(filepath).strip())