Datasets:
to_anserini.py: create the output directory
Browse files- to_anserini.py +2 -0
to_anserini.py
CHANGED
|
@@ -13,6 +13,7 @@ import argparse
|
|
| 13 |
import glob
|
| 14 |
import gzip
|
| 15 |
import json
|
|
|
|
| 16 |
|
| 17 |
import numpy as np
|
| 18 |
import pyarrow.parquet as pq
|
|
@@ -26,6 +27,7 @@ def main():
|
|
| 26 |
p.add_argument("--scale", type=float, default=100.0)
|
| 27 |
p.add_argument("--query", action="store_true")
|
| 28 |
a = p.parse_args()
|
|
|
|
| 29 |
opener = gzip.open if a.dst.endswith(".gz") else open
|
| 30 |
with opener(a.dst, "wt", encoding="utf-8") as out:
|
| 31 |
for f in sorted(glob.glob(f"{a.src}/part-*.parquet")):
|
|
|
|
| 13 |
import glob
|
| 14 |
import gzip
|
| 15 |
import json
|
| 16 |
+
from pathlib import Path
|
| 17 |
|
| 18 |
import numpy as np
|
| 19 |
import pyarrow.parquet as pq
|
|
|
|
| 27 |
p.add_argument("--scale", type=float, default=100.0)
|
| 28 |
p.add_argument("--query", action="store_true")
|
| 29 |
a = p.parse_args()
|
| 30 |
+
Path(a.dst).parent.mkdir(parents=True, exist_ok=True)
|
| 31 |
opener = gzip.open if a.dst.endswith(".gz") else open
|
| 32 |
with opener(a.dst, "wt", encoding="utf-8") as out:
|
| 33 |
for f in sorted(glob.glob(f"{a.src}/part-*.parquet")):
|