diff --git a/docs/src/auto_examples/core/run_similarity_queries.ipynb b/docs/src/auto_examples/core/run_similarity_queries.ipynb index 66b39ca2cc..e09bcd5a31 100644 --- a/docs/src/auto_examples/core/run_similarity_queries.ipynb +++ b/docs/src/auto_examples/core/run_similarity_queries.ipynb @@ -152,7 +152,7 @@ }, "outputs": [], "source": [ - "sims = sorted(enumerate(sims), key=lambda item: -item[1])\nfor i, s in enumerate(sims):\n print(s, documents[i])" + "sims = sorted(enumerate(sims), key=lambda item: -item[1])\nfor doc_position, doc_score in sims:\n print(doc_score, documents[doc_position])" ] }, { diff --git a/docs/src/auto_examples/core/run_similarity_queries.py b/docs/src/auto_examples/core/run_similarity_queries.py index 24b520e0ce..90de9d2c70 100644 --- a/docs/src/auto_examples/core/run_similarity_queries.py +++ b/docs/src/auto_examples/core/run_similarity_queries.py @@ -152,8 +152,8 @@ # order, and obtain the final answer to the query `"Human computer interaction"`: sims = sorted(enumerate(sims), key=lambda item: -item[1]) -for i, s in enumerate(sims): - print(s, documents[i]) +for doc_position, doc_score in sims: + print(doc_score, documents[doc_position]) ############################################################################### # The thing to note here is that documents no. 2 (``"The EPS user interface management system"``) diff --git a/docs/src/auto_examples/core/run_similarity_queries.rst b/docs/src/auto_examples/core/run_similarity_queries.rst index e745cc19d6..b3a107e80b 100644 --- a/docs/src/auto_examples/core/run_similarity_queries.rst +++ b/docs/src/auto_examples/core/run_similarity_queries.rst @@ -241,8 +241,8 @@ order, and obtain the final answer to the query `"Human computer interaction"`: sims = sorted(enumerate(sims), key=lambda item: -item[1]) - for i, s in enumerate(sims): - print(s, documents[i]) + for doc_position, doc_score in sims: + print(doc_score, documents[doc_position]) diff --git a/docs/src/gallery/core/run_similarity_queries.py b/docs/src/gallery/core/run_similarity_queries.py index 24b520e0ce..90de9d2c70 100644 --- a/docs/src/gallery/core/run_similarity_queries.py +++ b/docs/src/gallery/core/run_similarity_queries.py @@ -152,8 +152,8 @@ # order, and obtain the final answer to the query `"Human computer interaction"`: sims = sorted(enumerate(sims), key=lambda item: -item[1]) -for i, s in enumerate(sims): - print(s, documents[i]) +for doc_position, doc_score in sims: + print(doc_score, documents[doc_position]) ############################################################################### # The thing to note here is that documents no. 2 (``"The EPS user interface management system"``)