-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschemas.py
51 lines (33 loc) · 941 Bytes
/
schemas.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from typing import List
from pydantic import BaseModel
class FuzzyResult(BaseModel):
matching_name: str
matching_source: str
matching_uid: int
class TranslationResult(BaseModel):
translated_name: str
translated_source: str
translated_uid: int
# 3 in the diagram
class FuzzyMatching(BaseModel):
results: List[FuzzyResult]
# 2 in the diagram
class FuzzyQuery(BaseModel):
source_language: str
query: str
threshold: int = 10
nb_max_results: int = 10
class TranslationLanguagePair(BaseModel):
source_language: str
target_language: str
class Config:
from_attributes = True
class TranslationLanguageResult(BaseModel):
translations: List[TranslationLanguagePair]
# 6 in the diagram
class Translation(BaseModel):
results: List[TranslationResult]
# 5 in the diagram
class TranslationQuery(BaseModel):
translation_query: FuzzyResult
target_language: str