my code:
Codes removed by mentor as posting any grade function codes is considered against code of conduct. if a mentor wants to look at your codes they will ask you to send the code screenshot by personal DM, until then only post screenshot of error encountered or your expected output or failed submission grader info.
Output is a list of indices
bm25_retrieve(“What are the recent news about GDP?”)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[37], line 2
1 # Output is a list of indices
----> 2 bm25_retrieve("What are the recent news about GDP?")
Cell In[36], line 26, in bm25_retrieve(query, top_k)
22 tokenized_query = bm25s.tokenize(query)
24 # Use the 'BM25_RETRIEVER' to retrieve documents and their scores based on the tokenized query
25 # Retrieve the top 'k' documents
---> 26 results, scores = BM25_RETRIEVER.retrieve(tokenized_query, top_k)
28 # Extract the first element from 'results' to get the list of retrieved documents
29 results = results[0]
File /usr/local/lib/python3.12/site-packages/bm25s/__init__.py:923, in BM25.retrieve(self, query_tokens, corpus, k, sorted, return_as, show_progress, leave_progress, n_threads, chunksize, backend_selection, weight_mask)
921 else:
922 index_flat = indices.flatten().tolist()
--> 923 results = [corpus[i] for i in index_flat]
924 retrieved_docs = np.array(results).reshape(indices.shape)
926 if return_as == "tuple":
TypeError: 'int' object is not subscriptable
Need help with this error.