Skip to content

Commit

Permalink
Fix rerank (#60)
Browse files Browse the repository at this point in the history
* merge conflicts

* merge conflicts

* merge conflicts
  • Loading branch information
veekaybee committed Jul 12, 2023
1 parent 8611d32 commit c635492
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ test:
embed:
docker exec -it viberary-flask-1 python /viberary/src/index/index_embeddings.py


build:
docker compose build

Expand Down
1 change: 1 addition & 0 deletions src/index/index_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
conf = config()
embedding_data = Path(conf["training_data"]["path"]) / Path(conf["training_data"]["file"])


# Instantiate indexer
indexer = Indexer(
RedisConnection().conn(),
Expand Down
4 changes: 0 additions & 4 deletions src/search/knn_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def rescore(self, result_list: List[Tuple[float, str, str, str, int]]) -> List:
for index, val in enumerate(result_list, 1)
]


def dedup_by_number_of_reviews(
self, result_list: List[Tuple[float, str, str, str, int]]
) -> List[Tuple[float, str, str, str, int]]:
Expand All @@ -105,13 +104,11 @@ def dedup_by_number_of_reviews(
Args:
result_list ():
Returns: Deduped list by title and number of reviews
"""

deduped_list = []


titles = set()

for element in result_list:
Expand All @@ -121,5 +118,4 @@ def dedup_by_number_of_reviews(
else:
pass


return deduped_list[0:10]
1 change: 0 additions & 1 deletion src/search/tests/test_ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ def test_dedup(redis_mock):
]

rescore = KNNSearch(redis_mock).dedup_by_number_of_reviews(result_list)
print(rescore)
assert rescore == expected_list


Expand Down

0 comments on commit c635492

Please sign in to comment.