add
Browse files- create_yaml.py +34 -0
create_yaml.py
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import glob
|
2 |
+
import os
|
3 |
+
|
4 |
+
def read_folder(folder):
|
5 |
+
folder_name = os.path.basename(folder)
|
6 |
+
|
7 |
+
template = f"""- config_name: {folder_name}-corpus
|
8 |
+
data_files:
|
9 |
+
- split: train
|
10 |
+
path: {folder_name}/corpus/*
|
11 |
+
- config_name: {folder_name}-queries
|
12 |
+
data_files:"""
|
13 |
+
|
14 |
+
for filepath in glob.glob(f"{folder}/queries/*.parquet"):
|
15 |
+
template += f"""
|
16 |
+
- split: {os.path.basename(filepath).split('.')[0]}
|
17 |
+
path: {filepath}"""
|
18 |
+
|
19 |
+
template += f"""
|
20 |
+
- config_name: {folder_name}-qrels
|
21 |
+
data_files:"""
|
22 |
+
for filepath in glob.glob(f"{folder}/qrels/*.parquet"):
|
23 |
+
template += f"""
|
24 |
+
- split: {os.path.basename(filepath).split('.')[0]}
|
25 |
+
path: {filepath}"""
|
26 |
+
|
27 |
+
return template
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
for filepath in sorted(glob.glob("*")):
|
33 |
+
if os.path.isdir(filepath):
|
34 |
+
print(read_folder(filepath).strip())
|