Datasets:
Tasks:
Question Answering
Modalities:
Text
Formats:
parquet
Sub-tasks:
closed-domain-qa
Languages:
English
Size:
10K - 100K
License:
File size: 762 Bytes
7febd01 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import tarfile
from pathlib import Path
script_dir = Path(__file__).resolve().parent
scraped_files_root = "questions"
def extract_articles() -> Path:
articles = script_dir / scraped_files_root
if not articles.is_dir():
articles_archive = script_dir / f"{scraped_files_root}.tar.xz"
if not articles_archive.is_file():
raise RuntimeError(f"{scraped_files_root} directory / {scraped_files_root}.tar.xz archive not present in cwd")
with tarfile.open(articles_archive, "r:*") as tar:
tar.extractall()
articles = script_dir / scraped_files_root
if not articles.is_dir():
raise RuntimeError(f"tarfile extraction failed to produce {scraped_files_root} directory")
return articles
|