most-client 1.0.41__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/api.py +9 -3
- most/async_api.py +8 -3
- most/async_catalog.py +28 -0
- most/async_glossary.py +32 -0
- most/catalog.py +28 -0
- most/glossary.py +32 -0
- most/search_types.py +7 -1
- most/types.py +31 -0
- {most_client-1.0.41.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.41.dist-info → most_client-1.0.43.dist-info}/WHEEL +1 -1
- most_client-1.0.41.dist-info/RECORD +0 -16
- {most_client-1.0.41.dist-info → most_client-1.0.43.dist-info}/top_level.txt +0 -0
- {most_client-1.0.41.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
|
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/api.py
CHANGED
@@ -3,7 +3,7 @@ import os
|
|
3
3
|
import uuid
|
4
4
|
from datetime import datetime, timezone
|
5
5
|
from pathlib import Path
|
6
|
-
from typing import Dict, List, Optional, Union
|
6
|
+
from typing import Dict, List, Optional, Union, Literal
|
7
7
|
import json5
|
8
8
|
import httpx
|
9
9
|
from adaptix import Retort, loader
|
@@ -361,14 +361,20 @@ class MostClient(object):
|
|
361
361
|
resp = self.get(f"/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
362
362
|
return self.retort.load(resp.json(), Result)
|
363
363
|
|
364
|
-
def fetch_dialog(self, audio_id
|
364
|
+
def fetch_dialog(self, audio_id,
|
365
|
+
transcribator_name: Optional[Literal["GroundTruth"]] = None) -> DialogResult:
|
365
366
|
if not is_valid_id(self.model_id):
|
366
367
|
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
367
368
|
|
368
369
|
if not is_valid_id(audio_id):
|
369
370
|
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
370
371
|
|
371
|
-
|
372
|
+
params = {}
|
373
|
+
if transcribator_name is not None:
|
374
|
+
params["transcribator_name"] = transcribator_name
|
375
|
+
|
376
|
+
resp = self.get(f"/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog",
|
377
|
+
params=params)
|
372
378
|
return self.retort.load(resp.json(), DialogResult)
|
373
379
|
|
374
380
|
def update_dialog(self, audio_id, dialog: Dialog) -> DialogResult:
|
most/async_api.py
CHANGED
@@ -3,7 +3,7 @@ import os
|
|
3
3
|
import uuid
|
4
4
|
from datetime import datetime, timezone
|
5
5
|
from pathlib import Path
|
6
|
-
from typing import Dict, List, Optional, Union
|
6
|
+
from typing import Dict, List, Optional, Union, Literal
|
7
7
|
import httpx
|
8
8
|
import json5
|
9
9
|
from adaptix import Retort, loader
|
@@ -374,14 +374,19 @@ class AsyncMostClient(object):
|
|
374
374
|
resp = await self.get(f"/{self.client_id}/audio/{audio_id}/model/{self.model_id}/text")
|
375
375
|
return self.retort.load(resp.json(), Result)
|
376
376
|
|
377
|
-
async def fetch_dialog(self, audio_id
|
377
|
+
async def fetch_dialog(self, audio_id,
|
378
|
+
transcribator_name: Optional[Literal["GroundTruth"]] = None) -> DialogResult:
|
378
379
|
if not is_valid_id(self.model_id):
|
379
380
|
raise RuntimeError("Please choose valid model to apply. [try list_models()]")
|
380
381
|
|
381
382
|
if not is_valid_id(audio_id):
|
382
383
|
raise RuntimeError("Please use valid audio_id. [try audio.id from list_audios()]")
|
383
384
|
|
384
|
-
|
385
|
+
params = {}
|
386
|
+
if transcribator_name is not None:
|
387
|
+
params["transcribator_name"] = transcribator_name
|
388
|
+
resp = await self.get(f"/{self.client_id}/audio/{audio_id}/model/{self.model_id}/dialog",
|
389
|
+
params=params)
|
385
390
|
return self.retort.load(resp.json(), DialogResult)
|
386
391
|
|
387
392
|
async def update_dialog(self, audio_id, dialog: Dialog) -> DialogResult:
|
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
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
from .async_api import AsyncMostClient
|
4
|
+
from .types import GlossaryNGram
|
5
|
+
|
6
|
+
|
7
|
+
class AsyncGlossary(object):
|
8
|
+
def __init__(self, client: AsyncMostClient):
|
9
|
+
super(AsyncGlossary, self).__init__()
|
10
|
+
self.client = client
|
11
|
+
|
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])
|
18
|
+
|
19
|
+
async def list_ngrams(self) -> List[GlossaryNGram]:
|
20
|
+
resp = await self.client.get(f"/{self.client.client_id}/glossary")
|
21
|
+
return self.client.retort.load(resp.json(), List[GlossaryNGram])
|
22
|
+
|
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
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
from typing import List
|
2
|
+
|
3
|
+
from .api import MostClient
|
4
|
+
from .types import GlossaryNGram
|
5
|
+
|
6
|
+
|
7
|
+
class Glossary(object):
|
8
|
+
def __init__(self, client: MostClient):
|
9
|
+
super(Glossary, self).__init__()
|
10
|
+
self.client = client
|
11
|
+
|
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])
|
18
|
+
|
19
|
+
def list_ngrams(self) -> List[GlossaryNGram]:
|
20
|
+
resp = self.client.get(f"/{self.client.client_id}/glossary")
|
21
|
+
return self.client.retort.load(resp.json(), List[GlossaryNGram])
|
22
|
+
|
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/search_types.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from dataclasses import dataclass, field
|
2
|
-
from typing import List, Optional
|
2
|
+
from typing import List, Optional, Literal
|
3
3
|
from dataclasses_json import DataClassJsonMixin, dataclass_json
|
4
4
|
|
5
5
|
|
@@ -10,12 +10,14 @@ class IDCondition(DataClassJsonMixin):
|
|
10
10
|
in_set: Optional[List[str]] = None
|
11
11
|
greater_than: Optional[str] = None
|
12
12
|
less_than: Optional[str] = None
|
13
|
+
type: Literal["IDCondition"] = "IDCondition"
|
13
14
|
|
14
15
|
|
15
16
|
@dataclass_json
|
16
17
|
@dataclass
|
17
18
|
class ChannelsCondition(DataClassJsonMixin):
|
18
19
|
equal: Optional[int] = None
|
20
|
+
type: Literal["ChannelsCondition"] = "ChannelsCondition"
|
19
21
|
|
20
22
|
|
21
23
|
@dataclass_json
|
@@ -23,12 +25,14 @@ class ChannelsCondition(DataClassJsonMixin):
|
|
23
25
|
class DurationCondition(DataClassJsonMixin):
|
24
26
|
greater_than: Optional[int] = None
|
25
27
|
less_than: Optional[int] = None
|
28
|
+
type: Literal["DurationCondition"] = "DurationCondition"
|
26
29
|
|
27
30
|
|
28
31
|
@dataclass_json
|
29
32
|
@dataclass
|
30
33
|
class TagsCondition(DataClassJsonMixin):
|
31
34
|
in_set: Optional[List[str]] = None
|
35
|
+
type: Literal["TagsCondition"] = "TagsCondition"
|
32
36
|
|
33
37
|
|
34
38
|
@dataclass_json
|
@@ -40,6 +44,7 @@ class StoredInfoCondition(DataClassJsonMixin):
|
|
40
44
|
ends_with: Optional[str] = None
|
41
45
|
greater_than: Optional[int | str | float] = None
|
42
46
|
less_than: Optional[int | str | float] = None
|
47
|
+
type: Literal["StoredInfoCondition"] = "StoredInfoCondition"
|
43
48
|
|
44
49
|
|
45
50
|
@dataclass_json
|
@@ -52,6 +57,7 @@ class ResultsCondition(DataClassJsonMixin):
|
|
52
57
|
score_in_set: Optional[List[int]] = None
|
53
58
|
score_greater_than: Optional[int] = None
|
54
59
|
score_less_than: Optional[int] = None
|
60
|
+
type: Literal["ResultsCondition"] = "ResultsCondition"
|
55
61
|
|
56
62
|
def create_from(self, client,
|
57
63
|
column: str, subcolumn: str,
|
most/types.py
CHANGED
@@ -114,6 +114,37 @@ class Dialog(DataClassJsonMixin):
|
|
114
114
|
return ''.join([segment.to_text()
|
115
115
|
for segment in self.segments])
|
116
116
|
|
117
|
+
def to_raw_text(self):
|
118
|
+
return ' '.join([segment.text
|
119
|
+
for segment in self.segments])
|
120
|
+
|
121
|
+
def to_raw_speaker_text(self, speaker):
|
122
|
+
return ' '.join([segment.text
|
123
|
+
for segment in self.segments
|
124
|
+
if segment.speaker == speaker])
|
125
|
+
|
126
|
+
def get_speaker_names(self):
|
127
|
+
return list(set([segment.speaker
|
128
|
+
for segment in self.segments]))
|
129
|
+
|
130
|
+
|
131
|
+
@dataclass_json
|
132
|
+
@dataclass
|
133
|
+
class GlossaryNGram(DataClassJsonMixin):
|
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]
|
146
|
+
id: Optional[str] = None
|
147
|
+
|
117
148
|
|
118
149
|
@dataclass_json
|
119
150
|
@dataclass
|
@@ -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,16 +0,0 @@
|
|
1
|
-
most/__init__.py,sha256=yoPKMxjZYAzrVqZ7l9rN0Skh0HPuttPX7ub0wlZMby4,351
|
2
|
-
most/_constrants.py,sha256=SlHKcBoXwe_sPzk8tdbb7lqhQz-Bfo__FhSoeFWodZE,217
|
3
|
-
most/api.py,sha256=HmJSAwLVuy7uaeVAM3y1nd-F-UDZ2kOVww_i2EY0Sjs,19145
|
4
|
-
most/async_api.py,sha256=CTUpju0byI_HdE_zw3OPrNfRW-TXpTtoCK0tt7iVkXY,20429
|
5
|
-
most/async_searcher.py,sha256=C0zViW20K7OhKO1BzBZktTbMJYBBvor3uK6LAHZTxz0,2238
|
6
|
-
most/async_trainer_api.py,sha256=99rED8RjnOn8VezeEgrTgoVfQrO7DdmOE2Jajumno2g,1052
|
7
|
-
most/score_calculation.py,sha256=vLtGqXrR43xZhGjrH5dpQZfWX1q3s74LvTaHn-SKBAg,3254
|
8
|
-
most/search_types.py,sha256=NI4hK-ALJbyHW6ZhRGlGRVM6H2C2GsLNhQZb9YUMrnU,6854
|
9
|
-
most/searcher.py,sha256=9UdiSlScsE6EPc6RpK8xkRLeB5gHNxgPQpXTJ17i3lQ,2135
|
10
|
-
most/trainer_api.py,sha256=ZwOv4mhROfY97n6i7IY_ZpafsuNRazOqMBAf2dh708k,992
|
11
|
-
most/types.py,sha256=AU74VqYilM9DXfBwptliRbhV5urLAf4BygdIY3wlAN8,4309
|
12
|
-
most_client-1.0.41.dist-info/METADATA,sha256=sr64VTdOACoMc6zx4ZiF1G5p9cYQQtth13xpZ5BeXnI,1027
|
13
|
-
most_client-1.0.41.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
14
|
-
most_client-1.0.41.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
15
|
-
most_client-1.0.41.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
16
|
-
most_client-1.0.41.dist-info/RECORD,,
|
File without changes
|
File without changes
|