Spaces:
Sleeping
Sleeping
Added current_name_count
Browse files
utils.py
CHANGED
@@ -56,4 +56,12 @@ class Test:
|
|
56 |
for answer in question["responces"]:
|
57 |
for name in answer["name"]:
|
58 |
name_count[name] += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
return name_count
|
|
|
56 |
for answer in question["responces"]:
|
57 |
for name in answer["name"]:
|
58 |
name_count[name] += 1
|
59 |
+
return name_count
|
60 |
+
|
61 |
+
def current_name_count(self, answer_ids):
|
62 |
+
name_count = {name: 0 for name in self.names}
|
63 |
+
for question, answer_idx in zip(self.data, answer_ids):
|
64 |
+
answer = question["responces"][answer_idx]
|
65 |
+
for name in answer["name"]:
|
66 |
+
name_count[name] += 1
|
67 |
return name_count
|