most-client 1.0.40__py3-none-any.whl → 1.0.42__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 +1 -1
- most/api.py +9 -3
- most/async_api.py +8 -3
- most/async_glossary.py +18 -0
- most/glossary.py +18 -0
- most/search_types.py +17 -5
- most/types.py +21 -0
- {most_client-1.0.40.dist-info → most_client-1.0.42.dist-info}/METADATA +1 -1
- most_client-1.0.42.dist-info/RECORD +18 -0
- {most_client-1.0.40.dist-info → most_client-1.0.42.dist-info}/WHEEL +1 -1
- most_client-1.0.40.dist-info/RECORD +0 -16
- {most_client-1.0.40.dist-info → most_client-1.0.42.dist-info}/top_level.txt +0 -0
- {most_client-1.0.40.dist-info → most_client-1.0.42.dist-info}/zip-safe +0 -0
most/__init__.py
CHANGED
@@ -4,4 +4,4 @@ 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
|
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_glossary.py
ADDED
@@ -0,0 +1,18 @@
|
|
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
|
+
self.client = client
|
10
|
+
|
11
|
+
async def add_ngram(self, ngram: GlossaryNGram):
|
12
|
+
pass
|
13
|
+
|
14
|
+
async def list_ngrams(self) -> List[GlossaryNGram]:
|
15
|
+
return []
|
16
|
+
|
17
|
+
async def del_ngram(self, ngram_id: str):
|
18
|
+
pass
|
most/glossary.py
ADDED
@@ -0,0 +1,18 @@
|
|
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
|
+
self.client = client
|
10
|
+
|
11
|
+
def add_ngram(self, ngram: GlossaryNGram):
|
12
|
+
pass
|
13
|
+
|
14
|
+
def list_ngrams(self) -> List[GlossaryNGram]:
|
15
|
+
return []
|
16
|
+
|
17
|
+
def del_ngram(self, ngram_id: str):
|
18
|
+
pass
|
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,6 +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"
|
29
|
+
|
30
|
+
|
31
|
+
@dataclass_json
|
32
|
+
@dataclass
|
33
|
+
class TagsCondition(DataClassJsonMixin):
|
34
|
+
in_set: Optional[List[str]] = None
|
35
|
+
type: Literal["TagsCondition"] = "TagsCondition"
|
26
36
|
|
27
37
|
|
28
38
|
@dataclass_json
|
@@ -34,6 +44,7 @@ class StoredInfoCondition(DataClassJsonMixin):
|
|
34
44
|
ends_with: Optional[str] = None
|
35
45
|
greater_than: Optional[int | str | float] = None
|
36
46
|
less_than: Optional[int | str | float] = None
|
47
|
+
type: Literal["StoredInfoCondition"] = "StoredInfoCondition"
|
37
48
|
|
38
49
|
|
39
50
|
@dataclass_json
|
@@ -46,6 +57,7 @@ class ResultsCondition(DataClassJsonMixin):
|
|
46
57
|
score_in_set: Optional[List[int]] = None
|
47
58
|
score_greater_than: Optional[int] = None
|
48
59
|
score_less_than: Optional[int] = None
|
60
|
+
type: Literal["ResultsCondition"] = "ResultsCondition"
|
49
61
|
|
50
62
|
def create_from(self, client,
|
51
63
|
column: str, subcolumn: str,
|
@@ -135,7 +147,7 @@ class ResultsCondition(DataClassJsonMixin):
|
|
135
147
|
@dataclass_json
|
136
148
|
@dataclass
|
137
149
|
class SearchParams(DataClassJsonMixin):
|
138
|
-
must: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition ] = field(default_factory=list)
|
139
|
-
should: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition ] = field(default_factory=list)
|
140
|
-
must_not: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition ] = field(default_factory=list)
|
141
|
-
should_not: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition ] = field(default_factory=list)
|
150
|
+
must: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition | TagsCondition] = field(default_factory=list)
|
151
|
+
should: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition | TagsCondition ] = field(default_factory=list)
|
152
|
+
must_not: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition | TagsCondition ] = field(default_factory=list)
|
153
|
+
should_not: List[StoredInfoCondition | ResultsCondition | DurationCondition | ChannelsCondition | IDCondition | TagsCondition ] = field(default_factory=list)
|
most/types.py
CHANGED
@@ -114,6 +114,27 @@ 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
|
+
pronunciation: List[str]
|
135
|
+
original: List[str]
|
136
|
+
id: Optional[str] = None
|
137
|
+
|
117
138
|
|
118
139
|
@dataclass_json
|
119
140
|
@dataclass
|
@@ -0,0 +1,18 @@
|
|
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,,
|
@@ -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=OAtLDdpAPqH-ZYe0KxBuDbB-mUHp8eQM6-ZXUNvvBWU,6682
|
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.40.dist-info/METADATA,sha256=O_CE5dtc5zHPPrpysUsMHqTu3Axs17p5l98YWm13mWM,1027
|
13
|
-
most_client-1.0.40.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
14
|
-
most_client-1.0.40.dist-info/top_level.txt,sha256=2g5fk02LKkM1hV3pVVti_LQ60TToLBcR2zQ3JEKGVk8,5
|
15
|
-
most_client-1.0.40.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
16
|
-
most_client-1.0.40.dist-info/RECORD,,
|
File without changes
|
File without changes
|