2021-09-30 04:18:33 +02:00
|
|
|
# System Packages
|
2021-09-30 04:02:55 +02:00
|
|
|
from enum import Enum
|
2021-09-30 04:18:33 +02:00
|
|
|
from dataclasses import dataclass
|
2021-09-30 04:02:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SearchType(str, Enum):
|
|
|
|
Notes = "notes"
|
|
|
|
Ledger = "ledger"
|
|
|
|
Music = "music"
|
|
|
|
Image = "image"
|
|
|
|
|
2021-09-30 04:18:33 +02:00
|
|
|
|
|
|
|
@dataclass
|
|
|
|
class SearchSettings():
|
|
|
|
notes_search_enabled: bool = False
|
|
|
|
ledger_search_enabled: bool = False
|
|
|
|
music_search_enabled: bool = False
|
|
|
|
image_search_enabled: bool = False
|
|
|
|
|
|
|
|
|
2021-09-30 05:24:27 +02:00
|
|
|
class AsymmetricSearchModel():
|
|
|
|
def __init__(self, entries, corpus_embeddings, bi_encoder, cross_encoder, top_k):
|
|
|
|
self.entries = entries
|
|
|
|
self.corpus_embeddings = corpus_embeddings
|
|
|
|
self.bi_encoder = bi_encoder
|
|
|
|
self.cross_encoder = cross_encoder
|
|
|
|
self.top_k = top_k
|
|
|
|
|
|
|
|
|
2021-09-30 06:09:42 +02:00
|
|
|
class LedgerSearchModel():
|
|
|
|
def __init__(self, transactions, transaction_embeddings, symmetric_encoder, symmetric_cross_encoder, top_k):
|
|
|
|
self.transactions = transactions
|
|
|
|
self.transaction_embeddings = transaction_embeddings
|
|
|
|
self.symmetric_encoder = symmetric_encoder
|
|
|
|
self.symmetric_cross_encoder = symmetric_cross_encoder
|
|
|
|
self.top_k = top_k
|
|
|
|
|
|
|
|
|
|
|
|
class ImageSearchModel():
|
|
|
|
def __init__(self, image_names, image_embeddings, image_metadata_embeddings, image_encoder):
|
|
|
|
self.image_names = image_names
|
|
|
|
self.image_embeddings = image_embeddings
|
|
|
|
self.image_metadata_embeddings = image_metadata_embeddings
|
|
|
|
self.image_encoder = image_encoder
|
|
|
|
|
|
|
|
|
2021-09-30 05:24:27 +02:00
|
|
|
@dataclass
|
|
|
|
class SearchModels():
|
|
|
|
notes_search: AsymmetricSearchModel = None
|
2021-09-30 06:09:42 +02:00
|
|
|
ledger_search: LedgerSearchModel = None
|
|
|
|
music_search: AsymmetricSearchModel = None
|
|
|
|
image_search: ImageSearchModel = None
|