Searching for exact keyword using sbert models
I’m using one of the hugging face models: sentence-transformers/all-MiniLM-L6-v2 for semantic search. Currently I’m facing trouble while searching for exact keywords. This is basically required when searching for the following:a person’s name - John Davisa specific id/number - 2023a keyword containing special characters - Legal-Compliance,  Year’23, $200, Q&A.I have data of large lengths(more than 500 words) and so for embedding creation, the data is stripped into an array of sentences of length 100 each and then encoded and averaged.# embedding_tokens - array of sentence tokens
embedding = model.encode(embedding_tokens)
embeddings = np.mean(embedding, axis=0)These embeddings are then stored and searched using OpenSearch which currently is returning irrelevant results/less relevant results on the topCan someone help me with this. Is this the correct way to combine/average-out the embeddings? How do I search numbers and keywords with special characters here?
2024-07-26T19:14:35Z
i am looking for very similar solution, let me know if you find any solution.