diff --git a/anansyTypes/__init__.py b/anansyTypes/__init__.py index f91dca9..2ed458e 100644 --- a/anansyTypes/__init__.py +++ b/anansyTypes/__init__.py @@ -23,6 +23,7 @@ __all__ = [ "GetSimilarWordRequest", "GetAllPhrasesResponse", "GetSimilarSymbolsRequest", + "GetEmbeddingSimilarSymbolsRequest", "SearchSymbolsRequest", "GetSymbolsResponse", "ReplaceFinishedRequest", diff --git a/anansyTypes/schemas.py b/anansyTypes/schemas.py index 5778e9e..9c5902b 100644 --- a/anansyTypes/schemas.py +++ b/anansyTypes/schemas.py @@ -61,15 +61,24 @@ class GetFullPhrasesResponse(ModifiedBaseModel): phrases: Optional[List[Phrase]] class GetSimilarSymbolsRequest(ModifiedBaseModel): + """/replace: symbols to offer instead of `symbol`, which was shown for `word` in `sentence`.""" limit: int = 3 symbol: Symbol word: str sentence:str - + language: Optional[str] = None # fallback language for a caller with no account config (see ConfigFetcher) + +class GetEmbeddingSimilarSymbolsRequest(ModifiedBaseModel): + """Symbols nearest an embedding, leaving out the given words and symbols.""" + embedding: Embedding + limit: int = 3 + exclude_word_ids: List[int] = [] + exclude_symbol_ids: List[int] = [] class SearchSymbolsRequest(ModifiedBaseModel): query: str limit: int = 8 + language: Optional[str] = None # fallback language for a caller with no account config (see ConfigFetcher) @@ -94,11 +103,15 @@ class TextToSymbolResponse(ModifiedBaseModel): symbols: List[Symbol] class ReplaceFinishedRequest(ModifiedBaseModel): - """A correction: the sentence as heard, and the labels before and after.""" + """A correction: the sentence as heard, the word, and the symbols before and after (images left empty).""" sentence: str + word: str original: Symbol replacement: Symbol - language: str + source: Literal["alternative", "search"] # the /replace alternatives, or the /search results + rank: int # the replacement's position in the list it was picked from, from 0 + query: Optional[str] = None # the search text, for source "search" + language: Optional[str] = None # fallback language for a caller with no account config (see ConfigFetcher) #### Symbol hierarchy (jev translator) ####