Skip to content

Commit

Permalink
Improve documentation in run_similarity_queries example (#2770)
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinoMensio authored Mar 21, 2020
1 parent 68ec5b8 commit 0d75f2d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/auto_examples/core/run_similarity_queries.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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])"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/src/auto_examples/core/run_similarity_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"``)
Expand Down
4 changes: 2 additions & 2 deletions docs/src/auto_examples/core/run_similarity_queries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
4 changes: 2 additions & 2 deletions docs/src/gallery/core/run_similarity_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"``)
Expand Down

0 comments on commit 0d75f2d

Please sign in to comment.