Skip to content

Commit 5d1bc58

Browse files
committed
Get count
1 parent 0a6d510 commit 5d1bc58

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

create_data.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,9 +1574,12 @@ def test_check_unhelpful():
15741574
]
15751575
file = '/home/jon/Downloads/openassistant_oasst1_h2ogpt_graded.json'
15761576
data = json.load(open(file, 'rt'))
1577-
bads = []
1577+
bads = {}
15781578
for sub in unhelpful:
1579-
if sub in str(data):
1580-
bads.append(sub)
1581-
print("bad subs: %s" % bads, flush=True)
1579+
string_all = str(data)
1580+
bads[sub] = string_all.count(sub)
1581+
bads = {k: v for k, v in bads.items() if v > 0}
1582+
import pprint
1583+
pp = pprint.PrettyPrinter(indent=4)
1584+
pp.pprint(bads)
15821585
assert len(bads) == 0, bads

0 commit comments

Comments
 (0)