Replies: 1 comment 3 replies
-
This is not built in, but i think it should be easy to verify? E.g.: import bm25s
query = "what are cats?"
doc = "Cats are animals"
query_tokens = set(bm25s.tokenize(query, return_ids=False)[0])
doc_tokens = bm25s.tokenize(doc, return_ids=False)[0]
matches = [1 if dt in query_tokens else 0 for dt in doc_tokens] |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're trying to display some highlighting in the UI based on which tokens match. I can't find any method that returns the matching tokens from a query, but wanted to confirm? Ideally we'd have something in the
results
object from the callresults, scores = retriever.retrieve(...)
so we would know thatdocument ID #123
had tokens["fish", "cat"]
?Thank you
Beta Was this translation helpful? Give feedback.
All reactions