Download extraction_script/parse_files.py from sentence-transformers/reddit-title-body: direct link, hf CLI and curl.
- Browser
- Download file 401 Bytes
-
https://huggingface.co/datasets/sentence-transformers/reddit-title-body/resolve/main/extraction_script/parse_files.py
- Command line
-
hf download hf://datasets/sentence-transformers/reddit-title-body/extraction_script/parse_files.py
-
curl -L -o parse_files.py https://huggingface.co/datasets/sentence-transformers/reddit-title-body/resolve/main/extraction_script/parse_files.py
401 Bytes
| import sys | |
| import os | |
| import random | |
| print("#!/bin/sh") | |
| filepaths = sys.argv[1:] | |
| random.shuffle(filepaths) | |
| for filepath in filepaths: | |
| filename = os.path.basename(filepath) | |
| year = filename[3:7] | |
| cmd = f"zstdcat --long=31 {filepath} | python extract_title_selftext.py | gzip >> submissions_parsed/reddit_title_text_{year}.jsonl.gz" | |
| print(cmd) | |
| os.system(cmd) | |