most-client 1.0.42__py3-none-any.whl → 1.0.43__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- most/__init__.py +6 -1
- most/async_catalog.py +28 -0
- most/async_glossary.py +19 -5
- most/catalog.py +28 -0
- most/glossary.py +19 -5
- most/types.py +11 -1
- {most_client-1.0.42.dist-info → most_client-1.0.43.dist-info}/METADATA +1 -1
- most_client-1.0.43.dist-info/RECORD +20 -0
- {most_client-1.0.42.dist-info → most_client-1.0.43.dist-info}/WHEEL +1 -1
- most_client-1.0.42.dist-info/RECORD +0 -18
- {most_client-1.0.42.dist-info → most_client-1.0.43.dist-info}/top_level.txt +0 -0
- {most_client-1.0.42.dist-info → most_client-1.0.43.dist-info}/zip-safe +0 -0
most/__init__.py
CHANGED
@@ -4,4 +4,9 @@ from .trainer_api import Trainer
|
|
4
4
|
from .async_trainer_api import AsyncTrainer
|
5
5
|
from .searcher import MostSearcher
|
6
6
|
from .async_searcher import AsyncMostClient
|
7
|
-
from .search_types import SearchParams, IDCondition, ChannelsCondition, DurationCondition, ResultsCondition, StoredInfoCondition, TagsCondition
|
7
|
+
from .search_types import SearchParams, IDCondition, ChannelsCondition, DurationCondition, ResultsCondition, StoredInfoCondition, TagsCondition
|
8
|
+
from .glossary import Glossary
|
9
|
+
from .async_glossary import AsyncGlossary
|
10
|
+
from .catalog import Catalog
|
11
|
+
from .async_catalog import AsyncCatalog
|
12
|
+
from .types import GlossaryNGram, Item
|
most/async_catalog.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
from .async_api import AsyncMostClient
|
4
|
+
from .types import Item
|
5
|
+
|
6
|
+
|
7
|
+
class AsyncCatalog(object):
|
8
|
+
def __init__(self, client: AsyncMostClient):
|
9
|
+
super(AsyncCatalog, self).__init__()
|
10
|
+
self.client = client
|
11
|
+
|
12
|
+
async def add_items(self, items: List[Item] | Item) -> List[Item]:
|
13
|
+
if not isinstance(items, list):
|
14
|
+
items = [items]
|
15
|
+
resp = await self.client.post(f"/{self.client.client_id}/upload_items",
|
16
|
+
json=[item.to_dict() for item in items])
|
17
|
+
return self.client.retort.load(resp.json(), List[Item])
|
18
|
+
|
19
|
+
async def list_items(self) -> List[Item]:
|
20
|
+
resp = await self.client.get(f"/{self.client.client_id}/items")
|
21
|
+
return self.client.retort.load(resp.json(), List[Item])
|
22
|
+
|
23
|
+
async def delete_items(self, item_ids: List[str]):
|
24
|
+
if not isinstance(item_ids, list):
|
25
|
+
item_ids = [item_ids]
|
26
|
+
await self.client.post(f"/{self.client.client_id}/delete_items",
|
27
|
+
json=item_ids)
|
28
|
+
return self
|
most/async_glossary.py
CHANGED
@@ -6,13 +6,27 @@ from .types import GlossaryNGram
|
|
6
6
|
|
7
7
|
class AsyncGlossary(object):
|
8
8
|
def __init__(self, client: AsyncMostClient):
|
9
|
+
super(AsyncGlossary, self).__init__()
|
9
10
|
self.client = client
|
10
11
|
|
11
|
-
async def
|
12
|
-
|
12
|
+
async def add_ngrams(self, ngrams: List[GlossaryNGram] | GlossaryNGram) -> List[GlossaryNGram]:
|
13
|
+
if not isinstance(ngrams, list):
|
14
|
+
ngrams = [ngrams]
|
15
|
+
resp = await self.client.post(f"/{self.client.client_id}/upload_glossary",
|
16
|
+
json=[ngram.to_dict() for ngram in ngrams])
|
17
|
+
return self.client.retort.load(resp.json(), List[GlossaryNGram])
|
13
18
|
|
14
19
|
async def list_ngrams(self) -> List[GlossaryNGram]:
|
15
|
-
|
20
|
+
resp = await self.client.get(f"/{self.client.client_id}/glossary")
|
21
|
+
return self.client.retort.load(resp.json(), List[GlossaryNGram])
|
16
22
|
|
17
|
-
async def
|
18
|
-
|
23
|
+
async def del_ngrams(self, ngram_ids: List[str] | str):
|
24
|
+
if not isinstance(ngram_ids, list):
|
25
|
+
ngram_ids = [ngram_ids]
|
26
|
+
await self.client.post(f"/{self.client.client_id}/delete_glossary_ngrams",
|
27
|
+
json=ngram_ids)
|
28
|
+
return self
|
29
|
+
|
30
|
+
async def drop(self):
|
31
|
+
await self.client.post(f"/{self.client.client_id}/delete_glossary")
|
32
|
+
return self
|
most/catalog.py
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
from .api import MostClient
|
4
|
+
from .types import Item
|
5
|
+
|
6
|
+
|
7
|
+
class Catalog(object):
|
8
|
+
def __init__(self, client: MostClient):
|
9
|
+
super(Catalog, self).__init__()
|
10
|
+
self.client = client
|
11
|
+
|
12
|
+
def add_items(self, items: List[Item] | Item) -> List[Item]:
|
13
|
+
if not isinstance(items, list):
|
14
|
+
items = [items]
|
15
|
+
resp = self.client.post(f"/{self.client.client_id}/upload_items",
|
16
|
+
json=[item.to_dict() for item in items])
|
17
|
+
return self.client.retort.load(resp.json(), List[Item])
|
18
|
+
|
19
|
+
def list_items(self) -> List[Item]:
|
20
|
+
resp = self.client.get(f"/{self.client.client_id}/items")
|
21
|
+
return self.client.retort.load(resp.json(), List[Item])
|
22
|
+
|
23
|
+
def delete_items(self, item_ids: List[str]):
|
24
|
+
if not isinstance(item_ids, list):
|
25
|
+
item_ids = [item_ids]
|
26
|
+
self.client.post(f"/{self.client.client_id}/delete_items",
|
27
|
+
json=item_ids)
|
28
|
+
return self
|
most/glossary.py
CHANGED
@@ -6,13 +6,27 @@ from .types import GlossaryNGram
|
|
6
6
|
|
7
7
|
class Glossary(object):
|
8
8
|
def __init__(self, client: MostClient):
|
9
|
+
super(Glossary, self).__init__()
|
9
10
|
self.client = client
|
10
11
|
|
11
|
-
def
|
12
|
-
|
12
|
+
def add_ngrams(self, ngrams: List[GlossaryNGram] | GlossaryNGram) -> List[GlossaryNGram]:
|
13
|
+
if not isinstance(ngrams, list):
|
14
|
+
ngrams = [ngrams]
|
15
|
+
resp = self.client.post(f"/{self.client.client_id}/upload_glossary",
|
16
|
+
json=[ngram.to_dict() for ngram in ngrams])
|
17
|
+
return self.client.retort.load(resp.json(), List[GlossaryNGram])
|
13
18
|
|
14
19
|
def list_ngrams(self) -> List[GlossaryNGram]:
|
15
|
-
|
20
|
+
resp = self.client.get(f"/{self.client.client_id}/glossary")
|
21
|
+
return self.client.retort.load(resp.json(), List[GlossaryNGram])
|
16
22
|
|
17
|
-
def
|
18
|
-
|
23
|
+
def del_ngrams(self, ngram_ids: List[str] | str):
|
24
|
+
if not isinstance(ngram_ids, list):
|
25
|
+
ngram_ids = [ngram_ids]
|
26
|
+
self.client.post(f"/{self.client.client_id}/delete_glossary_ngrams",
|
27
|
+
json=ngram_ids)
|
28
|
+
return self
|
29
|
+
|
30
|
+
def drop(self):
|
31
|
+
self.client.post(f"/{self.client.client_id}/delete_glossary")
|
32
|
+
return self
|
most/types.py
CHANGED
@@ -131,8 +131,18 @@ class Dialog(DataClassJsonMixin):
|
|
131
131
|
@dataclass_json
|
132
132
|
@dataclass
|
133
133
|
class GlossaryNGram(DataClassJsonMixin):
|
134
|
-
pronunciation: List[str]
|
135
134
|
original: List[str]
|
135
|
+
pronunciation: List[str]
|
136
|
+
weight: float = 2
|
137
|
+
id: Optional[str] = None
|
138
|
+
|
139
|
+
|
140
|
+
@dataclass_json
|
141
|
+
@dataclass
|
142
|
+
class Item(DataClassJsonMixin):
|
143
|
+
title: str
|
144
|
+
pronunciation: str
|
145
|
+
metadata: Dict[str, str]
|
136
146
|
id: Optional[str] = None
|
137
147
|
|
138
148
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
most/__init__.py,sha256=ZA2n_h824tfGd5tFl3RsD0noUyv_T08fBoBxMEgxmzs,548
|
2
|
+
most/_constrants.py,sha256=SlHKcBoXwe_sPzk8tdbb7lqhQz-Bfo__FhSoeFWodZE,217
|
3
|
+
most/api.py,sha256=-DZK8TZ7_OdgUZTknqLW27i8YigXKM33W0vjr8b92gE,19401
|
4
|
+
most/async_api.py,sha256=RJkdQGuNJ9s-PuyHbcuVqGmp_GN5ry8bWbVzi8k4ed0,20696
|
5
|
+
most/async_catalog.py,sha256=LgQ5zghQtDMnqq-WjmRHqZkqcdixZnHtmoRaVv74VKM,1059
|
6
|
+
most/async_glossary.py,sha256=nehgkQvqENxT5vnmMiRLSWgD0jFr2Hzs7yqNZfC9ahs,1281
|
7
|
+
most/async_searcher.py,sha256=C0zViW20K7OhKO1BzBZktTbMJYBBvor3uK6LAHZTxz0,2238
|
8
|
+
most/async_trainer_api.py,sha256=99rED8RjnOn8VezeEgrTgoVfQrO7DdmOE2Jajumno2g,1052
|
9
|
+
most/catalog.py,sha256=XFu-pZdPyxyBcLDl9O3yiYvESXUolXTm0jsQKrQlHxc,985
|
10
|
+
most/glossary.py,sha256=64ld6cyvBe8jYW7OR1AVDoEPEAif5PFYu0Hgyng3Gkg,1195
|
11
|
+
most/score_calculation.py,sha256=vLtGqXrR43xZhGjrH5dpQZfWX1q3s74LvTaHn-SKBAg,3254
|
12
|
+
most/search_types.py,sha256=GFwXaDJV4qI_gaFZToLMHoYH-JXVfIVwfVTgJ7RDWoY,7211
|
13
|
+
most/searcher.py,sha256=9UdiSlScsE6EPc6RpK8xkRLeB5gHNxgPQpXTJ17i3lQ,2135
|
14
|
+
most/trainer_api.py,sha256=ZwOv4mhROfY97n6i7IY_ZpafsuNRazOqMBAf2dh708k,992
|
15
|
+
most/types.py,sha256=rfIfj_Dylrd_SGQl-GGlTMLUAjM6wI55TIsP3RwAsC4,5088
|
16
|
+
most_client-1.0.43.dist-info/METADATA,sha256=jql2yXek-OubXmLj4v8TmaZDoIgZIQKAUNXpGBwZ5U0,1027
|
17
|
+
most_client-1.0.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
18
|
+
most_client-1.0.43.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
19
|
+
most_client-1.0.43.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
20
|
+
most_client-1.0.43.dist-info/RECORD,,
|
@@ -1,18 +0,0 @@
|
|
1
|
-
most/__init__.py,sha256=UPx7vJhrRrSNsROGFJQr6-7Lw55qit0z-PIORw_HHFg,366
|
2
|
-
most/_constrants.py,sha256=SlHKcBoXwe_sPzk8tdbb7lqhQz-Bfo__FhSoeFWodZE,217
|
3
|
-
most/api.py,sha256=-DZK8TZ7_OdgUZTknqLW27i8YigXKM33W0vjr8b92gE,19401
|
4
|
-
most/async_api.py,sha256=RJkdQGuNJ9s-PuyHbcuVqGmp_GN5ry8bWbVzi8k4ed0,20696
|
5
|
-
most/async_glossary.py,sha256=kYb-6lptBJuBSHL1-dIPIEeT5RKuUkzyCAJWmKoZ7ec,408
|
6
|
-
most/async_searcher.py,sha256=C0zViW20K7OhKO1BzBZktTbMJYBBvor3uK6LAHZTxz0,2238
|
7
|
-
most/async_trainer_api.py,sha256=99rED8RjnOn8VezeEgrTgoVfQrO7DdmOE2Jajumno2g,1052
|
8
|
-
most/glossary.py,sha256=EO6TNJThqimU_gs7zN87JX0QKkSXbLtojPox57SL4XE,369
|
9
|
-
most/score_calculation.py,sha256=vLtGqXrR43xZhGjrH5dpQZfWX1q3s74LvTaHn-SKBAg,3254
|
10
|
-
most/search_types.py,sha256=GFwXaDJV4qI_gaFZToLMHoYH-JXVfIVwfVTgJ7RDWoY,7211
|
11
|
-
most/searcher.py,sha256=9UdiSlScsE6EPc6RpK8xkRLeB5gHNxgPQpXTJ17i3lQ,2135
|
12
|
-
most/trainer_api.py,sha256=ZwOv4mhROfY97n6i7IY_ZpafsuNRazOqMBAf2dh708k,992
|
13
|
-
most/types.py,sha256=mxE2KbvP88TzI6s6Aw_6JkV4uQXXEGG_hM310QOG-bo,4909
|
14
|
-
most_client-1.0.42.dist-info/METADATA,sha256=iF1o_VepUfy-s1rJZw-BcF0S5Rq2QpdK1goJwFRfsdI,1027
|
15
|
-
most_client-1.0.42.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
16
|
-
most_client-1.0.42.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
17
|
-
most_client-1.0.42.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
18
|
-
most_client-1.0.42.dist-info/RECORD,,
|
File without changes
|
File without changes
|