import re from collections import Counter import numpy as np from rank_bm25 import BM25Okapi from sentence_transformers import SentenceTransformer, util documents = [ { "id": "doc-001", "text": "Customers can request money back when their card is charged twice.", }, { "id": "doc-002", "text": "Policy ACME-482 covers duplicate invoice refunds.", }, { "id": "doc-003", "text": "Export monthly invoices from the billing dashboard.", }, { "id": "doc-004", "text": "Reset an expired password from the account security page.", }, { "id": "doc-005", "text": "Configure alerts for failed card payments.", }, ] query = "ACME-482 card charged two times"