Edward J. Schwartz
commited on
Commit
·
12b7aae
1
Parent(s):
5b87f77
Try again to fix new splits
Browse files- oo-method-test-split.py +11 -5
oo-method-test-split.py
CHANGED
|
@@ -133,7 +133,7 @@ class OOMethodTestDataset(datasets.ArrowBasedBuilder):
|
|
| 133 |
# A function (name) is a library function if it appears in more than one Exename
|
| 134 |
|
| 135 |
# this is (('func', 'oo.exe'): 123)
|
| 136 |
-
testcount = set(zip(ds['Name'],
|
| 137 |
|
| 138 |
# sorted pairs by function name
|
| 139 |
testcount = sorted(testcount, key=lambda x: x[0])
|
|
@@ -141,16 +141,22 @@ class OOMethodTestDataset(datasets.ArrowBasedBuilder):
|
|
| 141 |
# group by function name
|
| 142 |
grouped = itertools.groupby(testcount, lambda t: t[0])
|
| 143 |
|
|
|
|
| 144 |
grouped = {k: [b for _,b in g] for k, g in grouped}
|
|
|
|
|
|
|
| 145 |
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
| 147 |
# Exename
|
| 148 |
# v
|
| 149 |
-
library_func_names_dedup = {(f, exes[0][1]) for f, exes in grouped.items() if
|
| 150 |
# Binary
|
| 151 |
# v
|
| 152 |
-
library_func_names_dedup_all = {(f, exes[0][0]) for f, exes in grouped.items() if
|
| 153 |
-
nonlibrary_func_names = {f for f, exes in grouped.items() if
|
| 154 |
|
| 155 |
train_filter_fun = None
|
| 156 |
if self.config.name == "bylibrary":
|
|
|
|
| 133 |
# A function (name) is a library function if it appears in more than one Exename
|
| 134 |
|
| 135 |
# this is (('func', 'oo.exe'): 123)
|
| 136 |
+
testcount = set(zip(ds['Name'], zip(ds['Binary'], ds['Exename'])))
|
| 137 |
|
| 138 |
# sorted pairs by function name
|
| 139 |
testcount = sorted(testcount, key=lambda x: x[0])
|
|
|
|
| 141 |
# group by function name
|
| 142 |
grouped = itertools.groupby(testcount, lambda t: t[0])
|
| 143 |
|
| 144 |
+
# Move the function name to the key
|
| 145 |
grouped = {k: [b for _,b in g] for k, g in grouped}
|
| 146 |
+
print("WHAT")
|
| 147 |
+
#print(grouped)
|
| 148 |
|
| 149 |
+
def appears_in_single_exe(tuples):
|
| 150 |
+
return len({x[1] for x in tuples}) == 1
|
| 151 |
+
|
| 152 |
+
library_func_names = {f for f, exes in grouped.items() if not appears_in_single_exe(exes)}
|
| 153 |
# Exename
|
| 154 |
# v
|
| 155 |
+
library_func_names_dedup = {(f, exes[0][1]) for f, exes in grouped.items() if not appears_in_single_exe(exes)}
|
| 156 |
# Binary
|
| 157 |
# v
|
| 158 |
+
library_func_names_dedup_all = {(f, exes[0][0]) for f, exes in grouped.items() if not appears_in_single_exe(exes)}
|
| 159 |
+
nonlibrary_func_names = {f for f, exes in grouped.items() if appears_in_single_exe(exes)}
|
| 160 |
|
| 161 |
train_filter_fun = None
|
| 162 |
if self.config.name == "bylibrary":
|