Spaces:
Runtime error
Runtime error
Commit
·
495c86c
1
Parent(s):
9f92793
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,9 +72,11 @@ def preferences_from_hits(list_of_hits):
|
|
| 72 |
for result in list_of_hits:
|
| 73 |
for doc in result:
|
| 74 |
if doc["docid"] not in docid2id:
|
| 75 |
-
id = len(
|
| 76 |
docid2id[doc["docid"]] = id
|
| 77 |
id2doc[id] = doc
|
|
|
|
|
|
|
| 78 |
preferences.append([docid2id[doc["docid"]] for doc in result])
|
| 79 |
|
| 80 |
# = {v: k for k, v in docid2id.items()}
|
|
@@ -90,6 +92,7 @@ def aggregate(list_of_hits):
|
|
| 90 |
y_optimal = KemenyOptimalAggregator().aggregate(preferences)
|
| 91 |
# y_optimal = BordaRankAggregator().aggregate(preferences)
|
| 92 |
|
|
|
|
| 93 |
print("preference:")
|
| 94 |
print(preferences)
|
| 95 |
print("preferences shape: ", preferences.shape)
|
|
|
|
| 72 |
for result in list_of_hits:
|
| 73 |
for doc in result:
|
| 74 |
if doc["docid"] not in docid2id:
|
| 75 |
+
id = len(docid2id)
|
| 76 |
docid2id[doc["docid"]] = id
|
| 77 |
id2doc[id] = doc
|
| 78 |
+
print([doc["docid"] for doc in result])
|
| 79 |
+
print([docid2id[doc["docid"]] for doc in result])
|
| 80 |
preferences.append([docid2id[doc["docid"]] for doc in result])
|
| 81 |
|
| 82 |
# = {v: k for k, v in docid2id.items()}
|
|
|
|
| 92 |
y_optimal = KemenyOptimalAggregator().aggregate(preferences)
|
| 93 |
# y_optimal = BordaRankAggregator().aggregate(preferences)
|
| 94 |
|
| 95 |
+
print("-------------------------------------")
|
| 96 |
print("preference:")
|
| 97 |
print(preferences)
|
| 98 |
print("preferences shape: ", preferences.shape)
|