-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
71 lines (54 loc) · 1.42 KB
/
constants.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
This file contains constants
"""
from sentence_transformers import (
SentenceTransformer,
)
from config import configure
class WarningEnable:
"""
Class for warnings
"""
__enable = True # warning will be thrown if it is not True
__timezone = "always"
def get_status(self) -> bool:
"""
:returns __enable
"""
return self.__enable
def change_status(self, status: bool):
"""
Change __enable to status
:param status: to be changed to
"""
self.__enable = status
def disable_timezone_warn(self):
"""Change timezone warning to disable"""
self.__timezone = "ignore"
def enable_timezone_warn(self):
"""Change timezone warning to disable"""
self.__timezone = "always"
def get_timezone(self) -> str:
"""
:return: __timezone
"""
return self.__timezone
class TrainedModel:
"""
Class encapsulating trained module
"""
configure()
__model = SentenceTransformer("paraphrase-multilingual-mpnet-base-v2")
def set_module(self, model: SentenceTransformer):
"""
Sets __model
:param model: to be set
"""
self.__model = model
def get_module(self) -> SentenceTransformer:
"""
:return: __module
"""
return self.__model
warning_enable = WarningEnable()
trained_model = TrainedModel()