import tinysearch
documents = [
{"id": "0", "text": "hello there good man !"},
{"id": "1", "text": "how is the weather today ?"},
{"id": "2", "text": "it is quite windy in yokohama"},
]
searcher = tinysearch.bm25(documents)
# searcher = tinysearch.tfidf(documents)
# searcher = tinysearch.sif(documents, embeddings="path/to/embeddings.txt")
# searcher = tinysearch.transformer(documents, model_name="bert-base-uncased")
results = searcher.search("weather windy yokohama")
print(results)
# [{'id': '2', 'text': 'it is quite windy in yokohama'},
# {'id': '1', 'text': 'how is the weather today ?'}]
searcher.save("tinysearch.bin")
searcher = tinyserach.load("tinysearch.bin")
-
Notifications
You must be signed in to change notification settings - Fork 0
🔍 Tiny python library for sparse/dense search
License
altescy/tinysearch
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
🔍 Tiny python library for sparse/dense search
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published