SimilarityIndex#
SimilarityIndex is a main API for using similarity features of db-ally.
Explore Similarity Stores and Similarity Fetchers for ready to use integrations.
Tip
To learn more about using Similarity Indexes see how-to guides:
dbally.similarity.SimilarityIndex
#
SimilarityIndex(store: SimilarityStore, fetcher: SimilarityFetcher)
Bases: AbstractSimilarityIndex
Merges the store and the fetcher to provide a simple interface for keeping the data store and the similarity store in sync and finding similar texts.
PARAMETER | DESCRIPTION |
---|---|
store |
stores values gathered by the fetcher
TYPE:
|
fetcher |
fetches unique values to be indexed
TYPE:
|
Source code in src/dbally/similarity/index.py
update
async
#
similar
async
#
Finds the most similar text in the store or returns the original text if no similar text is found.
PARAMETER | DESCRIPTION |
---|---|
text |
The text to find similar to.
TYPE:
|
event_tracker |
The event tracker to use for auditing the similarity search.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The most similar text or the original text if no similar text is found.
TYPE:
|