Download scripts/r5_ref/ref_smoke_blank_labels.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 584 Bytes
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_smoke_blank_labels.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_ref/ref_smoke_blank_labels.py
-
curl -L -o ref_smoke_blank_labels.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_ref/ref_smoke_blank_labels.py
584 Bytes
| """R5 REF smoke test helper: copies a mix list and blanks the text of every 4th row (empty targets, as the clutter rows of mix_v1 have). | |
| Usage: python ref_smoke_blank_labels.py <in.tsv> <out.tsv>""" | |
| import sys | |
| lines = open(sys.argv[1], encoding="utf-8").read().split("\n") | |
| out = [lines[0]] | |
| n = 0 | |
| for i, line in enumerate(lines[1:]): | |
| if not line: | |
| continue | |
| f = line.split("\t") | |
| if i % 4 == 0: | |
| f[1] = "" | |
| n += 1 | |
| out.append("\t".join(f)) | |
| open(sys.argv[2], "w", encoding="utf-8").write("\n".join(out) + "\n") | |
| print("blanked", n, "of", len(out) - 1) | |