fix readme
Browse files- create_split.py +9 -9
- data/t_rex.filter_unified.min_entity_1_max_predicate_10.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_1_max_predicate_10.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_1_max_predicate_100.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_1_max_predicate_100.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_1_max_predicate_25.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_1_max_predicate_25.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_1_max_predicate_50.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_1_max_predicate_50.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_10.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_10.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_100.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_100.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_25.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_25.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_50.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_2_max_predicate_50.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_10.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_10.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_100.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_100.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_25.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_25.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_50.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_3_max_predicate_50.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_10.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_10.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_100.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_100.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_25.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_25.validation.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_50.train.jsonl +2 -2
- data/t_rex.filter_unified.min_entity_4_max_predicate_50.validation.jsonl +2 -2
- data/t_rex.filter_unified.test.jsonl +2 -2
- filtering_purify.py +0 -1
- t_rex.py +4 -4
create_split.py
CHANGED
@@ -37,19 +37,26 @@ if not os.path.exists("data/t_rex.filter_unified.test.jsonl"):
|
|
37 |
print(f"{json.dumps(i, indent=4)}")
|
38 |
flag = input(">>> (enter to add to test)")
|
39 |
if flag == '':
|
|
|
|
|
|
|
40 |
f_writer.write(json.dumps(i) + '\n')
|
41 |
f_writer.close()
|
42 |
|
43 |
with open("data/t_rex.filter_unified.test.jsonl") as f:
|
44 |
data_test = [json.loads(i) for i in f.read().split('\n') if len(i) > 0]
|
45 |
-
test_predicate = set([i['
|
46 |
|
47 |
|
48 |
seed(42)
|
49 |
for min_e_freq, max_p_freq in product(parameters_min_e_freq, parameters_max_p_freq):
|
50 |
with open(f"data/t_rex.filter_unified.min_entity_{min_e_freq}_max_predicate_{max_p_freq}.jsonl") as f:
|
51 |
data = [json.loads(i) for i in f.read().split('\n') if len(i) > 0]
|
52 |
-
|
|
|
|
|
|
|
|
|
53 |
shuffle(data)
|
54 |
data_train = data[:int(len(data) * 0.9)]
|
55 |
data_valid = data[int(len(data) * 0.9):]
|
@@ -57,10 +64,3 @@ for min_e_freq, max_p_freq in product(parameters_min_e_freq, parameters_max_p_fr
|
|
57 |
f.write('\n'.join([json.dumps(i) for i in data_train]))
|
58 |
with open(f"data/t_rex.filter_unified.min_entity_{min_e_freq}_max_predicate_{max_p_freq}.validation.jsonl", "w") as f:
|
59 |
f.write('\n'.join([json.dumps(i) for i in data_valid]))
|
60 |
-
|
61 |
-
|
62 |
-
#
|
63 |
-
# # make test split
|
64 |
-
# with open(f"data/t_rex.filter_unified.jsonl") as f:
|
65 |
-
# data = [json.loads(i) for i in f.read().split('\n') if len(i) > 0]
|
66 |
-
# train_data, validation_data, test_data = create_split(data)
|
|
|
37 |
print(f"{json.dumps(i, indent=4)}")
|
38 |
flag = input(">>> (enter to add to test)")
|
39 |
if flag == '':
|
40 |
+
i['relation'] = i.pop('predicate')
|
41 |
+
i['head'] = i.pop('subject')
|
42 |
+
i['tail'] = i.pop('object')
|
43 |
f_writer.write(json.dumps(i) + '\n')
|
44 |
f_writer.close()
|
45 |
|
46 |
with open("data/t_rex.filter_unified.test.jsonl") as f:
|
47 |
data_test = [json.loads(i) for i in f.read().split('\n') if len(i) > 0]
|
48 |
+
test_predicate = set([i['relation'] for i in data_test])
|
49 |
|
50 |
|
51 |
seed(42)
|
52 |
for min_e_freq, max_p_freq in product(parameters_min_e_freq, parameters_max_p_freq):
|
53 |
with open(f"data/t_rex.filter_unified.min_entity_{min_e_freq}_max_predicate_{max_p_freq}.jsonl") as f:
|
54 |
data = [json.loads(i) for i in f.read().split('\n') if len(i) > 0]
|
55 |
+
for i in data:
|
56 |
+
i['relation'] = i.pop('predicate')
|
57 |
+
i['head'] = i.pop('subject')
|
58 |
+
i['tail'] = i.pop('object')
|
59 |
+
data = [i for i in data if i['relation'] not in test_predicate]
|
60 |
shuffle(data)
|
61 |
data_train = data[:int(len(data) * 0.9)]
|
62 |
data_valid = data[int(len(data) * 0.9):]
|
|
|
64 |
f.write('\n'.join([json.dumps(i) for i in data_train]))
|
65 |
with open(f"data/t_rex.filter_unified.min_entity_{min_e_freq}_max_predicate_{max_p_freq}.validation.jsonl", "w") as f:
|
66 |
f.write('\n'.join([json.dumps(i) for i in data_valid]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/t_rex.filter_unified.min_entity_1_max_predicate_10.train.jsonl
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:a8cdbf3a283b002925fec1afdc7dd361371fa7fcb74e8cf30992d5e8d260de59
|
3 |
+
size 1565697
|
data/t_rex.filter_unified.min_entity_1_max_predicate_10.validation.jsonl
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:66005b0dcfc95d73531b68f83b1d99d0a23c8896dc1e9a0134dfe6d18000320b
|
3 |
+
size 166879
|
data/t_rex.filter_unified.min_entity_1_max_predicate_100.train.jsonl
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:b3c554b56bae1e5c5fc857ecff4cb0c5084c5f359b83339933fbbd6a1dfb4964
|
3 |
+
size 9443433
|
data/t_rex.filter_unified.min_entity_1_max_predicate_100.validation.jsonl
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:ee5a21bab254e93893686be4295317ab3baa306f4f5201f62d909285f719dd9c
|
3 |
+
size 968939
|
data/t_rex.filter_unified.min_entity_1_max_predicate_25.train.jsonl
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:d9042463fe69bc8be135a9bae519fac5937f43e3701e7130e0cde76badaed82c
|
3 |
+
size 3247191
|
data/t_rex.filter_unified.min_entity_1_max_predicate_25.validation.jsonl
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:63db817d18ff85b07df3a2762939dcece12fd2010a8857add034362342706bab
|
3 |
+
size 358106
|
data/t_rex.filter_unified.min_entity_1_max_predicate_50.train.jsonl
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:f13171463ef6e69eea94cc300d38f54b492a85f470c1c72c73b6e40c2cf83f5e
|
3 |
+
size 5637411
|
data/t_rex.filter_unified.min_entity_1_max_predicate_50.validation.jsonl
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:afd61d9ed3f524a6226e49db437df518165f9a7dde18e3b873cf4c1d62c3ebef
|
3 |
+
size 630575
|
data/t_rex.filter_unified.min_entity_2_max_predicate_10.train.jsonl
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:df4eb48be825c5db70006eb41f47570c68a29acb4dc04aaf7a155cea119de729
|
3 |
+
size 1171693
|
data/t_rex.filter_unified.min_entity_2_max_predicate_10.validation.jsonl
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:86e09036006125140f912f05c4529bafd6c2331562003ed2f7c9fd1b0e159afa
|
3 |
+
size 160711
|
data/t_rex.filter_unified.min_entity_2_max_predicate_100.train.jsonl
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:8483f5be57b80552ecb4710cbf53abcfe45ea91e463284f575b8c8d5d5f2b4d8
|
3 |
+
size 6594932
|
data/t_rex.filter_unified.min_entity_2_max_predicate_100.validation.jsonl
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:24d6efe638a4ba043612f2ba52dc81501d22d20a55b877e60cd124a73eac77e9
|
3 |
+
size 761362
|
data/t_rex.filter_unified.min_entity_2_max_predicate_25.train.jsonl
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:6ef6f8cc1bbce41ee85eef2fd186cb96aa9658eec8687d9843797936f6ee0d9b
|
3 |
+
size 2439166
|
data/t_rex.filter_unified.min_entity_2_max_predicate_25.validation.jsonl
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:993405320d0811ffbda37456a21856c5257852bd88d1041e9f22034059237954
|
3 |
+
size 261204
|
data/t_rex.filter_unified.min_entity_2_max_predicate_50.train.jsonl
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:34bc9f4463c4bd1f085d4219b58a4314ba8b330822517b355c1bb4b2d651f2a2
|
3 |
+
size 4211619
|
data/t_rex.filter_unified.min_entity_2_max_predicate_50.validation.jsonl
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:8878b991b0d700ff0da61abd4368001fbed3d0d91d87cdc49128052813e004d0
|
3 |
+
size 454146
|
data/t_rex.filter_unified.min_entity_3_max_predicate_10.train.jsonl
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:1d349e003f740bfd092142bda3a18b53a50fc2e42d776ab927b671fd683d6b3d
|
3 |
+
size 982946
|
data/t_rex.filter_unified.min_entity_3_max_predicate_10.validation.jsonl
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:62841e632a18ccb85dd287fdb971b29dde73c0b4a5df98fd70f50567c89b5f2b
|
3 |
+
size 128757
|
data/t_rex.filter_unified.min_entity_3_max_predicate_100.train.jsonl
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:fc7dc0801745bfece68deba3c72eb1a377c168d9127e14af9045e5998df078eb
|
3 |
+
size 5028185
|
data/t_rex.filter_unified.min_entity_3_max_predicate_100.validation.jsonl
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:4e692671afd4d3e991f0ebefe3cd59df2b3851bcbe021ad3df5a3a06856b7420
|
3 |
+
size 553214
|
data/t_rex.filter_unified.min_entity_3_max_predicate_25.train.jsonl
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:a1f44e3e50ba4a2a75af5b1144de4170decef738c52ea649a6db57108c545c53
|
3 |
+
size 2001435
|
data/t_rex.filter_unified.min_entity_3_max_predicate_25.validation.jsonl
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:9f54c63116a78e4712451be2e7452a25ede659311f397f5e925501e790ad98ad
|
3 |
+
size 210939
|
data/t_rex.filter_unified.min_entity_3_max_predicate_50.train.jsonl
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:893673af83b9bc5fd73669d2000884936ccf55e2184405d518d552aeba7b3b85
|
3 |
+
size 3311200
|
data/t_rex.filter_unified.min_entity_3_max_predicate_50.validation.jsonl
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:3f08bd81057414dbd5b399a43eaa1805853be53e6edabc058b7842ebd4323851
|
3 |
+
size 350629
|
data/t_rex.filter_unified.min_entity_4_max_predicate_10.train.jsonl
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:335cd6b2be2e1abbf677efebb5e4dda545d8cd79a04a25433ac13ab77fd78b29
|
3 |
+
size 869233
|
data/t_rex.filter_unified.min_entity_4_max_predicate_10.validation.jsonl
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:2298db64d6f839621db2cbcc200e77cd1b9178c7e25ba46a86aa2a0e63a3816b
|
3 |
+
size 100260
|
data/t_rex.filter_unified.min_entity_4_max_predicate_100.train.jsonl
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:282ec575b1f35f5ea11b76a3d7e98d6257f3419fa396dc19c71b3f6879890cf5
|
3 |
+
size 4194801
|
data/t_rex.filter_unified.min_entity_4_max_predicate_100.validation.jsonl
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:c46d0beeac6bc592c3e8058ace196d3d254db0fda3c103963e324d8eb5e44ecd
|
3 |
+
size 462067
|
data/t_rex.filter_unified.min_entity_4_max_predicate_25.train.jsonl
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:f1d0e2edc50dff9f8a34eb70a311f128a461ff0aaf5d2afea8be85767c55b010
|
3 |
+
size 1757714
|
data/t_rex.filter_unified.min_entity_4_max_predicate_25.validation.jsonl
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:8f9e4e4369959100b1266c60c0865c20078bc5550e76ad31f20ad8fede048ea8
|
3 |
+
size 206898
|
data/t_rex.filter_unified.min_entity_4_max_predicate_50.train.jsonl
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:d7ea19e24ae2bef133da5e7118d04b91e047c528643c0fc4469a3937646b5ce6
|
3 |
+
size 2816287
|
data/t_rex.filter_unified.min_entity_4_max_predicate_50.validation.jsonl
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:9d895b67231ad903e0e94770c4a07c711c0152e5745b30a0f814b589c3b300cb
|
3 |
+
size 312327
|
data/t_rex.filter_unified.test.jsonl
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:21c903c02acc553fa21bd2fcdbec73cf8dd170f4ad9a3fd3dbb910e3991b9dbe
|
3 |
+
size 172728
|
filtering_purify.py
CHANGED
@@ -71,7 +71,6 @@ def main(min_entity_freq, max_pairs_predicate, min_pairs_predicate: int = 3, ran
|
|
71 |
df_balanced.pop("count_object")
|
72 |
df_balanced.pop("count_sum")
|
73 |
df_balanced = df_balanced.drop_duplicates(subset=['subject', 'object', 'predicate'], keep='last')
|
74 |
-
|
75 |
# return data
|
76 |
target_data = [i.to_dict() for _, i in df_balanced.iterrows()]
|
77 |
predicate_dist = df_balanced.groupby("predicate")['text'].count().sort_values(ascending=False).to_dict()
|
|
|
71 |
df_balanced.pop("count_object")
|
72 |
df_balanced.pop("count_sum")
|
73 |
df_balanced = df_balanced.drop_duplicates(subset=['subject', 'object', 'predicate'], keep='last')
|
|
|
74 |
# return data
|
75 |
target_data = [i.to_dict() for _, i in df_balanced.iterrows()]
|
76 |
predicate_dist = df_balanced.groupby("predicate")['text'].count().sort_values(ascending=False).to_dict()
|
t_rex.py
CHANGED
@@ -7,7 +7,7 @@ import datasets
|
|
7 |
logger = datasets.logging.get_logger(__name__)
|
8 |
_DESCRIPTION = """T-Rex dataset."""
|
9 |
_NAME = "t_rex"
|
10 |
-
_VERSION = "0.0
|
11 |
_CITATION = """
|
12 |
@inproceedings{elsahar2018t,
|
13 |
title={T-rex: A large scale alignment of natural language with knowledge base triples},
|
@@ -77,11 +77,11 @@ class TREX(datasets.GeneratorBasedBuilder):
|
|
77 |
description=_DESCRIPTION,
|
78 |
features=datasets.Features(
|
79 |
{
|
|
|
|
|
|
|
80 |
"title": datasets.Value("string"),
|
81 |
"text": datasets.Value("string"),
|
82 |
-
"predicate": datasets.Value("string"),
|
83 |
-
"object": datasets.Value("string"),
|
84 |
-
"subject": datasets.Value("string")
|
85 |
}
|
86 |
),
|
87 |
supervised_keys=None,
|
|
|
7 |
logger = datasets.logging.get_logger(__name__)
|
8 |
_DESCRIPTION = """T-Rex dataset."""
|
9 |
_NAME = "t_rex"
|
10 |
+
_VERSION = "0.1.0"
|
11 |
_CITATION = """
|
12 |
@inproceedings{elsahar2018t,
|
13 |
title={T-rex: A large scale alignment of natural language with knowledge base triples},
|
|
|
77 |
description=_DESCRIPTION,
|
78 |
features=datasets.Features(
|
79 |
{
|
80 |
+
"relation": datasets.Value("string"),
|
81 |
+
"head": datasets.Value("string"),
|
82 |
+
"tail": datasets.Value("string"),
|
83 |
"title": datasets.Value("string"),
|
84 |
"text": datasets.Value("string"),
|
|
|
|
|
|
|
85 |
}
|
86 |
),
|
87 |
supervised_keys=None,
|