Datasets:
KennethEnevoldsen
commited on
removed empty text files
Browse files- remove_empty/remove_empty.log +0 -0
- remove_empty/remove_empty.py +54 -0
- test/ar.jsonl.gz +2 -2
- test/de-en.jsonl.gz +2 -2
- test/de-fr.jsonl.gz +2 -2
- test/de-pl.jsonl.gz +2 -2
- test/de.jsonl.gz +2 -2
- test/en.jsonl.gz +2 -2
- test/es-en.jsonl.gz +2 -2
- test/es-it.jsonl.gz +2 -2
- test/es.jsonl.gz +2 -2
- test/fr-pl.jsonl.gz +2 -2
- test/fr.jsonl.gz +2 -2
- test/it.jsonl.gz +2 -2
- test/pl-en.jsonl.gz +2 -2
- test/pl.jsonl.gz +2 -2
- test/ru.jsonl.gz +2 -2
- test/tr.jsonl.gz +2 -2
- test/zh-en.jsonl.gz +2 -2
- test/zh.jsonl.gz +2 -2
- train/ar.jsonl.gz +2 -2
- train/de-en.jsonl.gz +2 -2
- train/de.jsonl.gz +2 -2
- train/en.jsonl.gz +2 -2
- train/es.jsonl.gz +2 -2
- train/fr.jsonl.gz +2 -2
- train/pl.jsonl.gz +2 -2
- train/tr.jsonl.gz +2 -2
remove_empty/remove_empty.log
ADDED
The diff for this file is too large to render.
See raw diff
|
|
remove_empty/remove_empty.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pathlib import Path
|
2 |
+
|
3 |
+
import mteb
|
4 |
+
|
5 |
+
log_file_path = Path("remove_empty.log")
|
6 |
+
|
7 |
+
# remove log file if exists
|
8 |
+
if log_file_path.exists():
|
9 |
+
log_file_path.unlink()
|
10 |
+
|
11 |
+
tasks = mteb.get_tasks(tasks=["STS22"])
|
12 |
+
task = tasks[0]
|
13 |
+
|
14 |
+
task.load_data()
|
15 |
+
|
16 |
+
|
17 |
+
def filter_sample(x):
|
18 |
+
if len(x["sentence1"]) > 0 and len(x["sentence2"]) > 0:
|
19 |
+
return True
|
20 |
+
log = f"Filtered: {x['sentence1']} -- {x['sentence2']}"
|
21 |
+
with open(log_file_path, "a") as f:
|
22 |
+
f.write(log + "\n")
|
23 |
+
print(log)
|
24 |
+
return False
|
25 |
+
|
26 |
+
|
27 |
+
for hf_subset in task.dataset:
|
28 |
+
_ds = task.dataset[hf_subset]
|
29 |
+
for split in _ds:
|
30 |
+
ds = _ds[split]
|
31 |
+
# filter empty sentences
|
32 |
+
n_samples = len(ds)
|
33 |
+
ds = ds.filter(lambda x: filter_sample(x))
|
34 |
+
n_left = len(ds)
|
35 |
+
log = f"Filtered {n_samples - n_left} samples from {n_samples} in {hf_subset} - {split}"
|
36 |
+
with open(log_file_path, "a") as f:
|
37 |
+
f.write(log + "\n")
|
38 |
+
print(log)
|
39 |
+
_ds[split] = ds
|
40 |
+
|
41 |
+
task.dataset[hf_subset] = _ds
|
42 |
+
|
43 |
+
save_path = Path(__file__).parent.parent
|
44 |
+
|
45 |
+
for hf_subset in task.dataset:
|
46 |
+
_ds = task.dataset[hf_subset]
|
47 |
+
for split in _ds:
|
48 |
+
ds = _ds[split]
|
49 |
+
ds.to_json(save_path / split / (hf_subset + ".jsonl.gz"), compression="gzip")
|
50 |
+
log = f"Saved {hf_subset} - {split} to {save_path / split / (hf_subset + '.jsonl.gz')}"
|
51 |
+
|
52 |
+
with open(log_file_path, "a") as f:
|
53 |
+
f.write(log + "\n")
|
54 |
+
print(log)
|
test/ar.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:187eb168ffec0aefee35ca6b3229f7d6584acbf889850152f4d6bda2a4e7a176
|
3 |
+
size 328511
|
test/de-en.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:90f8e602800fa5ff941d97b84d120084b55e9ada3124f1a174a373ab25eb0d39
|
3 |
+
size 308458
|
test/de-fr.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a86358f459079e8a764747eae4c76d1bd87b7ba0ca759e7ad695e5cb9edae17
|
3 |
+
size 236251
|
test/de-pl.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9818e535b44bcd78a479ebd85b54f8ea392885f78a102f2651c2ec46b0ad2c0e
|
3 |
+
size 91332
|
test/de.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:28d2ddb2d30b768f6a6ee0869808adf861e4293d843d546d97b352c403792bb8
|
3 |
+
size 819127
|
test/en.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ee23e28a49d9cf8441ce152600c6bf5334fc5346effd62d8359d26e3314e63eb
|
3 |
+
size 425298
|
test/es-en.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:01b3fbe3909d6795d4508279d5a994b3c9434e0dd80b8eb219bb4d63992f3179
|
3 |
+
size 836853
|
test/es-it.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a453d85ad8451de6f13c8931d5b3b18f3ea4c73ee23d11fd410d27bdaef4e07c
|
3 |
+
size 432309
|
test/es.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e282ee0378ad37ab77f3b32a9eca4e5e487bd124235dc47df9d0a5198ec4ec9c
|
3 |
+
size 279325
|
test/fr-pl.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:d12bbfb51e2a13ac7b12406fe98616ab42c2cbf3eb09c6a29505d91470a4462b
|
3 |
+
size 22047
|
test/fr.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:62f4b1e305145c36c4565951e60f934776f83267b8c17eb06e76d0c89519e78c
|
3 |
+
size 200329
|
test/it.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e50cc118bff99f42767a40817e2de9a5e78668f6c371239ac1358fa8c15ba00b
|
3 |
+
size 580370
|
test/pl-en.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0a88c480b346723fbec627b98db6d0897e5c3e26ec2e6989313a264a470e8a8a
|
3 |
+
size 120128
|
test/pl.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e1ced4c58d7a804393b7b53bf1486645e07b9f703188458f1610822d58b33402
|
3 |
+
size 304228
|
test/ru.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:752faa8c082023be8dc3c23353b9a0968b14ad009dcc31035c7c654315bbe939
|
3 |
+
size 495875
|
test/tr.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:53bc7b2c311a2e278d5901953624e837bd17609b2e52f68e514ae4fc43a211b8
|
3 |
+
size 327831
|
test/zh-en.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:99176a7078e9d69ef35f435afd926473b2a0a79cc9ef10b8f4a2f4b3cc134039
|
3 |
+
size 513457
|
test/zh.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:06f285366193eb6604032995c296a6146eacf8aa0128b4a8c4a40397bdf7992b
|
3 |
+
size 1208745
|
train/ar.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:77e7a31949f26449b17282ebf8f2a3781b870c9cb36b0c0d9b0706d7283b8de6
|
3 |
+
size 367773
|
train/de-en.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:87ccfb4866958da246a7528102d282e7cc4081e5bfd49d6dcb799e18abc63524
|
3 |
+
size 1114867
|
train/de.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1b37b74ade3a3787e5bce1b6d8d7876cb59f866ecfbb7d488127a0d1e7b1a862
|
3 |
+
size 1417784
|
train/en.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:042075ce053649000d1398f15fc9557ebae62068f91f778d78ff60cd85e6c6a9
|
3 |
+
size 4004671
|
train/es.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:3098d94fb89df84a40fe0f8ffcba32f0afb21861978bffc20794b9ac59ad6103
|
3 |
+
size 841866
|
train/fr.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f8d8f7b01354495aec086f3dfaf59473faa2d314925f53505913b8e505fdebfd
|
3 |
+
size 131109
|
train/pl.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0683c5982f16c2ea73176af6b0e0c1f3d05daf16dfd9159b02f6131ed90d37af
|
3 |
+
size 578179
|
train/tr.jsonl.gz
CHANGED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f0be5cf7a35777547f266c3dc2c92496a2e2e92ce1fcd9469311667980cdec49
|
3 |
+
size 560057
|