diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e67d1b..98ba26c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.11.0] - 2023-08-25 + +### Added + +- Add support for batch topic detection + ## [1.10.0] - 2023-08-02 ### Added diff --git a/README.md b/README.md index cecd765..df8520e 100644 --- a/README.md +++ b/README.md @@ -300,6 +300,12 @@ A complete list of commands and flags can be found in the SDK docs at https://sp speechmatics batch transcribe --sentiment-analysis --output-format json-v2 example_audio.wav ``` +- Submit a job with topic detection + + ```bash + speechmatics batch transcribe --detect-topics --output-format json-v2 example_audio.wav + ``` + ### Custom Transcription Config File - Instead of passing all the transcription options via the command line you can also pass a transcription config file. The config file is a JSON file that contains the transcription options. diff --git a/VERSION b/VERSION index 81c871d..1cac385 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.10.0 +1.11.0 diff --git a/docs/_modules/speechmatics/batch_client.html b/docs/_modules/speechmatics/batch_client.html index 6e6c373..f3ef8aa 100644 --- a/docs/_modules/speechmatics/batch_client.html +++ b/docs/_modules/speechmatics/batch_client.html @@ -39,15 +39,16 @@
import json
import logging
import os
+from pathlib import Path
import time
-from typing import Any, Dict, List, Tuple, Union
+from typing import Any, Dict, Iterable, List, Tuple, Union
import httpx
from polling2 import poll
from speechmatics.exceptions import JobNotFoundException, TranscriptionError
from speechmatics.helpers import get_version
-from speechmatics.models import BatchTranscriptionConfig, UsageMode, ConnectionSettings
+from speechmatics.models import BatchTranscriptionConfig, ConnectionSettings, UsageMode
LOGGER = logging.getLogger(__name__)
@@ -58,6 +59,15 @@ Source code for speechmatics.batch_client
POLLING_DURATION = 15
+# This is a reasonable default for when multiple audio files are submitted for
+# transcription in one go, in submit_jobs.
+#
+# Customers are free to increase this to any kind of maximum they are
+# comfortable with, but bear in mind there will be rate-limitting at the API
+# end for over-use.
+CONCURRENCY_DEFAULT = 5
+CONCURRENCY_MAXIMUM = 50
+
class _ForceMultipartDict(dict):
"""Creates a dictionary that evaluates to True, even if empty.
@@ -105,7 +115,11 @@ Source code for speechmatics.batch_client
"""
- def __init__(self, connection_settings_or_auth_token: Union[str, ConnectionSettings, None] = None, from_cli=False):
+ def __init__(
+ self,
+ connection_settings_or_auth_token: Union[str, ConnectionSettings, None] = None,
+ from_cli=False,
+ ):
"""
Args:
connection_settings_or_auth_token (Union[str, ConnectionSettings, None], optional)
@@ -115,14 +129,18 @@ Source code for speechmatics.batch_client
from_clie (bool)
"""
if not isinstance(connection_settings_or_auth_token, ConnectionSettings):
- self.connection_settings = ConnectionSettings.create(UsageMode.Batch, connection_settings_or_auth_token)
+ self.connection_settings = ConnectionSettings.create(
+ UsageMode.Batch, connection_settings_or_auth_token
+ )
else:
self.connection_settings = connection_settings_or_auth_token
+ self.connection_settings.set_missing_values_from_config(UsageMode.Batch)
if self.connection_settings.url[-1] == "/":
self.connection_settings.url = self.connection_settings.url[:-1]
-
if not self.connection_settings.url.endswith("/v2"):
- self.connection_settings.url = "/".join([self.connection_settings.url, "v2"])
+ self.connection_settings.url = "/".join(
+ [self.connection_settings.url, "v2"]
+ )
self.connection_settings = self.connection_settings
self.transcription_config = None
@@ -223,7 +241,9 @@ Source code for speechmatics.batch_client
# Handle getting config into a dict
if isinstance(transcription_config, (str or os.PathLike)):
- with open(transcription_config, mode="rt", encoding="utf-8") as file:
+ with Path(transcription_config).expanduser().open(
+ mode="rt", encoding="utf-8"
+ ) as file:
config_dict = json.load(file)
elif isinstance(transcription_config, BatchTranscriptionConfig):
config_dict = json.loads(transcription_config.as_config())
@@ -241,7 +261,7 @@ Source code for speechmatics.batch_client
if not audio and "fetch_data" in config_dict:
audio_data = None
elif isinstance(audio, (str, os.PathLike)):
- with open(audio, "rb") as file:
+ with Path(audio).expanduser().open("rb") as file:
audio_data = os.path.basename(file.name), file.read()
elif isinstance(audio, tuple) and "fetch_data" not in config_dict:
audio_data = audio
@@ -259,6 +279,43 @@ Source code for speechmatics.batch_client
response = self.send_request("POST", "jobs", data=config_data, files=audio_file)
return response.json()["id"]
+ def submit_jobs(
+ self,
+ audio_paths: Iterable[Union[str, os.PathLike]],
+ transcription_config: Any,
+ concurrency=CONCURRENCY_DEFAULT,
+ ):
+ if concurrency > CONCURRENCY_MAXIMUM:
+ raise Exception(
+ f"concurrency={concurrency} is too high, choose a value <= {CONCURRENCY_MAXIMUM}!"
+ )
+ pool = {}
+
+ def wait():
+ while True:
+ for job_id in list(pool):
+ path = pool[job_id]
+ status = self.check_job_status(job_id)["job"]["status"]
+ LOGGER.debug("%s for %s is %s", job_id, path, status)
+ if status == "running":
+ continue
+ del pool[job_id]
+ return path, job_id
+ time.sleep(POLLING_DURATION)
+
+ for audio_path in audio_paths:
+ if len(pool) >= concurrency:
+ yield wait()
+ try:
+ job_id = self.submit_job(audio_path, transcription_config)
+ LOGGER.debug("%s submitted as job %s", audio_path, job_id)
+ pool[job_id] = audio_path
+ except httpx.HTTPStatusError as exc:
+ LOGGER.warning("%s submit failed with %s", audio_path, exc)
+
+ while pool:
+ yield wait()
+
[docs] def get_job_result(
self,
job_id: str,
diff --git a/docs/_modules/speechmatics/client.html b/docs/_modules/speechmatics/client.html
index 62e9077..f2ac32c 100644
--- a/docs/_modules/speechmatics/client.html
+++ b/docs/_modules/speechmatics/client.html
@@ -42,9 +42,10 @@ Source code for speechmatics.client
import json
import logging
import os
+from typing import Union
from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse
-from typing import Union
+import httpx
import websockets
from speechmatics.exceptions import (
@@ -52,18 +53,15 @@ Source code for speechmatics.client
ForceEndSession,
TranscriptionError,
)
+from speechmatics.helpers import get_version, json_utf8, read_in_chunks
from speechmatics.models import (
- ClientMessageType,
- ServerMessageType,
AudioSettings,
+ ClientMessageType,
ConnectionSettings,
+ ServerMessageType,
TranscriptionConfig,
UsageMode,
)
-from speechmatics.constants import RT_SELF_SERVICE_URL
-from speechmatics.config import read_config_from_home
-from speechmatics.helpers import get_version, json_utf8, read_in_chunks
-from speechmatics.models import ClientMessageType, ServerMessageType
LOGGER = logging.getLogger(__name__)
@@ -92,16 +90,19 @@ Source code for speechmatics.client
self,
connection_settings_or_auth_token: Union[str, ConnectionSettings, None] = None,
):
- """
+ """
Args:
- connection_settings_or_auth_token (Union[str, ConnectionSettings, None], optional): _description_. Defaults to None.
- If `str`,, assumes auth_token passed and default URL being used
- If `None`, attempts using auth_token from config.
+ connection_settings_or_auth_token (Union[str, ConnectionSettings, None], optional): Defaults to None.
+ If `str`,, assumes auth_token passed and default URL being used
+ If `None`, attempts using auth_token from config.
"""
if not isinstance(connection_settings_or_auth_token, ConnectionSettings):
- self.connection_settings = ConnectionSettings.create(UsageMode.RealTime, connection_settings_or_auth_token)
+ self.connection_settings = ConnectionSettings.create(
+ UsageMode.RealTime, connection_settings_or_auth_token
+ )
else:
self.connection_settings = connection_settings_or_auth_token
+ self.connection_settings.set_missing_values_from_config(UsageMode.RealTime)
self.websocket = None
self.transcription_config = None
self.translation_config = None
@@ -443,7 +444,8 @@ Source code for speechmatics.client
stream,
transcription_config: TranscriptionConfig,
audio_settings=AudioSettings(),
- from_cli=False):
+ from_cli=False,
+ ):
"""
Begin a new recognition session.
This will run asynchronously. Most callers may prefer to use
@@ -487,11 +489,11 @@ Source code for speechmatics.client
extra_headers["Authorization"] = token
url = self.connection_settings.url
- if not url.endswith(self.transcription_config.language):
+ if not url.endswith(self.transcription_config.language.strip()):
if url.endswith("/"):
- url += self.transcription_config.language
+ url += self.transcription_config.language.strip()
else:
- url += f"/{self.transcription_config.language}"
+ url += f"/{self.transcription_config.language.strip()}"
# Extend connection url with sdk version information
cli = "-cli" if from_cli is True else ""
diff --git a/docs/_modules/speechmatics/models.html b/docs/_modules/speechmatics/models.html
index fe94159..ddaaf86 100644
--- a/docs/_modules/speechmatics/models.html
+++ b/docs/_modules/speechmatics/models.html
@@ -38,17 +38,23 @@ Source code for speechmatics.models
import json
import ssl
-
+import sys
from dataclasses import asdict, dataclass, field, fields
from enum import Enum
-
from typing import Any, Dict, List, Optional
+
from speechmatics.config import CONFIG_PATH, read_config_from_home
+from speechmatics.constants import BATCH_SELF_SERVICE_URL, RT_SELF_SERVICE_URL
+
+if sys.version_info >= (3, 8):
+ from typing import Literal
+else:
+ from typing_extensions import Literal # pragma: no cover
+
-from speechmatics.constants import (
- BATCH_SELF_SERVICE_URL,
- RT_SELF_SERVICE_URL,
-)
+SummaryContentType = Literal["informative", "conversational", "auto"]
+SummaryLength = Literal["brief", "detailed"]
+SummaryType = Literal["paragraphs", "bullets"]
[docs]@dataclass
@@ -73,7 +79,7 @@ Source code for speechmatics.models
url: str
"""URL for notification. The `id` and `status` query parameters will be added."""
- contents: str = None
+ contents: List[str] = None
"""
Specifies a list of items to be attached to the notification message.
When multiple items are requested, they are included as named file
@@ -83,7 +89,7 @@ Source code for speechmatics.models
method: str = "post"
"""The HTTP(S) method to be used. Only `post` and `put` are supported."""
- auth_headers: str = None
+ auth_headers: List[str] = None
"""
A list of additional headers to be added to the notification request
when using http or https. This is intended to support authentication or
@@ -207,6 +213,33 @@ Source code for speechmatics.models
"""Expected languages for language identification"""
+[docs]@dataclass
+class SummarizationConfig:
+ """Defines summarization parameters."""
+
+ content_type: SummaryContentType = "auto"
+ """Optional summarization content_type parameter."""
+
+ summary_length: SummaryLength = "brief"
+ """Optional summarization summary_length parameter."""
+
+ summary_type: SummaryType = "bullets"
+ """Optional summarization summary_type parameter."""
+
+
+
+
+
+[docs]@dataclass
+class TopicDetectionConfig:
+ """Defines topic detection parameters."""
+
+ topics: List[str] = None
+ """Optional list of topics for topic detection."""
+
+
[docs]@dataclass(init=False)
class TranscriptionConfig(_TranscriptionConfig):
# pylint: disable=too-many-instance-attributes
@@ -231,6 +264,12 @@ Source code for speechmatics.models
speaker_change_sensitivity: float = None
"""Sensitivity level for speaker change."""
+ streaming_mode: bool = None
+ """Indicates if we run the engine in streaming mode, or regular RT mode."""
+
+ ctrl: dict = None
+ """Internal Speechmatics flag that allows to give special commands to the engine."""
+
enable_partials: bool = None
"""Indicates if partials for both transcripts and translation, where words are produced
immediately, is enabled."""
@@ -262,6 +301,7 @@ Source code for speechmatics.models
[docs]@dataclass(init=False)
class BatchTranscriptionConfig(_TranscriptionConfig):
+ # pylint: disable=too-many-instance-attributes
"""Batch: Defines transcription parameters for batch requests.
The `.as_config()` method will return it wrapped into a Speechmatics json config."""
@@ -286,6 +326,15 @@ Source code for speechmatics.models
channel_diarization_labels: List[str] = None
"""Add your own speaker or channel labels to the transcript"""
+ summarization_config: SummarizationConfig = None
+ """Optional configuration for transcript summarization."""
+
+ sentiment_analysis_config: Optional[SentimentAnalysisConfig] = None
+ """Optional configuration for sentiment analysis of the transcript"""
+
+ topic_detection_config: Optional[TopicDetectionConfig] = None
+ """Optional configuration for detecting topics of the transcript"""
+
def as_config(self):
dictionary = self.asdict()
@@ -296,7 +345,9 @@ Source code for speechmatics.models
)
translation_config = dictionary.pop("translation_config", None)
srt_overrides = dictionary.pop("srt_overrides", None)
-
+ summarization_config = dictionary.pop("summarization_config", None)
+ sentiment_analysis_config = dictionary.pop("sentiment_analysis_config", None)
+ topic_detection_config = dictionary.pop("topic_detection_config", None)
config = {"type": "transcription", "transcription_config": dictionary}
if fetch_data:
@@ -316,6 +367,15 @@ Source code for speechmatics.models
if srt_overrides:
config["output_config"] = {"srt_overrides": srt_overrides}
+ if summarization_config:
+ config["summarization_config"] = summarization_config
+
+ if sentiment_analysis_config is not None:
+ config["sentiment_analysis_config"] = sentiment_analysis_config
+
+ if topic_detection_config:
+ config["topic_detection_config"] = topic_detection_config
+
return json.dumps(config)
@@ -343,10 +403,13 @@ Source code for speechmatics.models
"sample_rate": self.sample_rate,
}
+
+
[docs]@dataclass
class ConnectionSettings:
"""Defines connection parameters."""
@@ -366,36 +429,52 @@ Source code for speechmatics.models
ping_timeout_seconds: float = 60
"""Ping-pong timeout in seconds."""
- auth_token: str = None
+ auth_token: Optional[str] = None
"""auth token to authenticate a customer."""
generate_temp_token: Optional[bool] = False
"""Automatically generate a temporary token for authentication.
Non-enterprise customers must set this to True. Enterprise customers should set this to False."""
+ def set_missing_values_from_config(self, mode: UsageMode):
+ stored_config = read_config_from_home()
+ if self.url is None or self.url == "":
+ url_key = "realtime_url" if mode == UsageMode.RealTime else "batch_url"
+ if stored_config and url_key in stored_config:
+ self.url = stored_config[url_key]
+ else:
+ raise ValueError(f"No URL provided or set in {CONFIG_PATH}")
+ if self.auth_token is None or self.auth_token == "":
+ if stored_config and stored_config.get("auth_token"):
+ self.auth_token = stored_config["auth_token"]
+
@classmethod
def create(cls, mode: UsageMode, auth_token: Optional[str] = None):
stored_config = read_config_from_home()
- if stored_config and "url" in stored_config:
- url = stored_config["url"]
+ default_url = (
+ RT_SELF_SERVICE_URL
+ if mode == UsageMode.RealTime
+ else BATCH_SELF_SERVICE_URL
+ )
+ url_key = "realtime_url" if mode == UsageMode.RealTime else "batch_url"
+ if stored_config and url_key in stored_config:
+ url = stored_config[url_key]
else:
- url = RT_SELF_SERVICE_URL if mode == UsageMode.RealTime else BATCH_SELF_SERVICE_URL
+ url = default_url
if auth_token is not None:
return ConnectionSettings(
url=url,
auth_token=auth_token,
generate_temp_token=True,
)
- else:
- if stored_config and stored_config.get("auth_token"):
- url = stored_config.get("url", RT_SELF_SERVICE_URL)
- return ConnectionSettings(
- url,
- auth_token=stored_config["auth_token"],
- generate_temp_token=stored_config.get("generate_temp_token", True),
- )
- else:
- raise ValueError(f"No acces token provided or set in {CONFIG_PATH}")
+ if stored_config and stored_config.get("auth_token"):
+ url = stored_config.get(url_key, default_url)
+ return ConnectionSettings(
+ url,
+ auth_token=stored_config["auth_token"],
+ generate_temp_token=stored_config.get("generate_temp_token", True),
+ )
+ raise ValueError(f"No acces token provided or set in {CONFIG_PATH}")
[docs]@dataclass
diff --git a/docs/_sources/cli_parser.rst.txt b/docs/_sources/cli_parser.rst.txt
index b4d4975..00f32ab 100644
--- a/docs/_sources/cli_parser.rst.txt
+++ b/docs/_sources/cli_parser.rst.txt
@@ -1,6 +1,6 @@
Speechmatics CLI Tool
=========================
-.. argparse::
+.. argparse::
:module: speechmatics.cli_parser
:func: get_arg_parser
:prog: speechmatics
diff --git a/docs/_static/pygments.css b/docs/_static/pygments.css
index 9abe04b..57c7df3 100644
--- a/docs/_static/pygments.css
+++ b/docs/_static/pygments.css
@@ -22,6 +22,7 @@ span.linenos.special { color: #000000; background-color: #ffffc0; padding-left:
.highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */
.highlight .gd { color: #a40000 } /* Generic.Deleted */
.highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */
+.highlight .ges { color: #000000 } /* Generic.EmphStrong */
.highlight .gr { color: #ef2929 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
diff --git a/docs/cli_parser.html b/docs/cli_parser.html
index f589331..a248f37 100644
--- a/docs/cli_parser.html
+++ b/docs/cli_parser.html
@@ -36,7 +36,7 @@
Speechmatics CLI Tool¶
CLI for Speechmatics products.
-usage: speechmatics [-h] [-v] [--debug] {rt,batch,transcribe,config} ...
+usage: speechmatics [-h] [-v] [--debug] [--ctrl CTRL] {rt,batch,transcribe,config} ...
@@ -50,6 +50,9 @@ Named Arguments
@@ -81,14 +84,11 @@ Sub-commands
transcribe¶
Transcribe an audio file or stream in real time and output the results to the console.
-speechmatics rt transcribe [-h] [--enable-partials] [--punctuation-sensitivity PUNCTUATION_SENSITIVITY] [--speaker-diarization-max-speakers SPEAKER_DIARIZATION_MAX_SPEAKERS]
- [--speaker-change-sensitivity SPEAKER_CHANGE_SENSITIVITY] [--speaker-change-token] [--max-delay MAX_DELAY] [--max-delay-mode {fixed,flexible}]
- [--raw ENCODING] [--sample-rate SAMPLE_RATE] [--chunk-size CHUNK_SIZE] [--buffer-size BUFFER_SIZE] [--print-json]
- [--diarization {none,speaker,speaker_change}] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token]
- [--profile PROFILE] [--config-file CONFIG_FILE] [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN]
- [--output-locale LOCALE] [--additional-vocab [ADDITIONAL_VOCAB ...]] [--additional-vocab-file VOCAB_FILEPATH]
- [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS] [--enable-entities] [--translation-langs TRANSLATION_TARGET_LANGUAGES]
- [--langid-langs LANGID_EXPECTED_LANGUAGES]
+speechmatics rt transcribe [-h] [--streaming-mode] [--enable-partials] [--enable-transcription-partials] [--enable-translation-partials] [--punctuation-sensitivity PUNCTUATION_SENSITIVITY] [--speaker-diarization-max-speakers SPEAKER_DIARIZATION_MAX_SPEAKERS]
+ [--speaker-change-sensitivity SPEAKER_CHANGE_SENSITIVITY] [--speaker-change-token] [--max-delay MAX_DELAY] [--max-delay-mode {fixed,flexible}] [--raw ENCODING] [--sample-rate SAMPLE_RATE] [--chunk-size CHUNK_SIZE]
+ [--buffer-size BUFFER_SIZE] [--print-json] [--diarization {none,speaker,speaker_change}] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE] [--config-file CONFIG_FILE]
+ [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN] [--output-locale LOCALE] [--additional-vocab [ADDITIONAL_VOCAB [ADDITIONAL_VOCAB ...]]] [--additional-vocab-file VOCAB_FILEPATH]
+ [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS] [--enable-entities] [--translation-langs TRANSLATION_TARGET_LANGUAGES] [--langid-langs LANGID_EXPECTED_LANGUAGES]
FILEPATHS [FILEPATHS ...]
@@ -103,10 +103,22 @@ Positional Arguments
Named Arguments¶
+- --streaming-mode
+Whether to run the engine in streaming mode. Internal Speechmatics use only.
+Default: False
+
- --enable-partials
+Whether to return partials for both transcripts and translation which can be updated by later,final transcripts.
+Default: False
+
+- --enable-transcription-partials
Whether to return partial transcripts which can be updated by later,final transcripts.
Default: False
+- --enable-translation-partials
+Whether to return partial translation which can be updated by later,final translation.
+Default: False
+
- --punctuation-sensitivity
Sensitivity level for advanced punctuation.
@@ -228,13 +240,11 @@ Sub-commands
transcribe¶
Transcribe one or more audio files using batch mode, while waiting for results.
-speechmatics batch transcribe [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE]
- [--config-file CONFIG_FILE] [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN] [--output-locale LOCALE]
- [--additional-vocab [ADDITIONAL_VOCAB ...]] [--additional-vocab-file VOCAB_FILEPATH]
- [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS] [--enable-entities] [--translation-langs TRANSLATION_TARGET_LANGUAGES]
- [--langid-langs LANGID_EXPECTED_LANGUAGES] [--output-format {txt,json,json-v2,srt}]
- [--speaker-diarization-sensitivity SPEAKER_DIARIZATION_SENSITIVITY] [--diarization {none,speaker,channel,channel_and_speaker_change}]
- [--channel-diarization-labels CHANNEL_DIARIZATION_LABELS [CHANNEL_DIARIZATION_LABELS ...]]
+speechmatics batch transcribe [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE] [--config-file CONFIG_FILE] [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN]
+ [--output-locale LOCALE] [--additional-vocab [ADDITIONAL_VOCAB [ADDITIONAL_VOCAB ...]]] [--additional-vocab-file VOCAB_FILEPATH] [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS] [--enable-entities]
+ [--translation-langs TRANSLATION_TARGET_LANGUAGES] [--langid-langs LANGID_EXPECTED_LANGUAGES] [--output-format {txt,json,json-v2,srt}] [--speaker-diarization-sensitivity SPEAKER_DIARIZATION_SENSITIVITY]
+ [--diarization {none,speaker,channel,channel_and_speaker_change}] [--channel-diarization-labels CHANNEL_DIARIZATION_LABELS [CHANNEL_DIARIZATION_LABELS ...]] [--summarize] [--summary-content-type {informative,conversational,auto}]
+ [--summary-length {brief,detailed}] [--summary-type {paragraphs,bullets}] [--sentiment-analysis] [--topic-detection] [--topic-detection-topics TOPICS]
FILEPATHS [FILEPATHS ...]
@@ -317,19 +327,41 @@ Named Arguments
submit¶
Submit one or more files for transcription.
-speechmatics batch submit [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE]
- [--config-file CONFIG_FILE] [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN] [--output-locale LOCALE]
- [--additional-vocab [ADDITIONAL_VOCAB ...]] [--additional-vocab-file VOCAB_FILEPATH] [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS]
- [--enable-entities] [--translation-langs TRANSLATION_TARGET_LANGUAGES] [--langid-langs LANGID_EXPECTED_LANGUAGES]
- [--output-format {txt,json,json-v2,srt}] [--speaker-diarization-sensitivity SPEAKER_DIARIZATION_SENSITIVITY]
- [--diarization {none,speaker,channel,channel_and_speaker_change}]
- [--channel-diarization-labels CHANNEL_DIARIZATION_LABELS [CHANNEL_DIARIZATION_LABELS ...]]
+speechmatics batch submit [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE] [--config-file CONFIG_FILE] [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN]
+ [--output-locale LOCALE] [--additional-vocab [ADDITIONAL_VOCAB [ADDITIONAL_VOCAB ...]]] [--additional-vocab-file VOCAB_FILEPATH] [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS] [--enable-entities]
+ [--translation-langs TRANSLATION_TARGET_LANGUAGES] [--langid-langs LANGID_EXPECTED_LANGUAGES] [--output-format {txt,json,json-v2,srt}] [--speaker-diarization-sensitivity SPEAKER_DIARIZATION_SENSITIVITY]
+ [--diarization {none,speaker,channel,channel_and_speaker_change}] [--channel-diarization-labels CHANNEL_DIARIZATION_LABELS [CHANNEL_DIARIZATION_LABELS ...]] [--summarize] [--summary-content-type {informative,conversational,auto}]
+ [--summary-length {brief,detailed}] [--summary-type {paragraphs,bullets}] [--sentiment-analysis] [--topic-detection] [--topic-detection-topics TOPICS]
FILEPATHS [FILEPATHS ...]
@@ -412,6 +444,30 @@ Named Arguments
get-results¶
Retrieve results of a transcription job.
-speechmatics batch get-results [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE]
- [--output-format {txt,json,json-v2,srt}] --job-id JOB_ID
+speechmatics batch get-results [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE] [--output-format {txt,json,json-v2,srt}] --job-id JOB_ID
@@ -487,8 +542,7 @@ Named Arguments
delete¶
Delete the results of a transcription job.
-speechmatics batch delete [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE]
- [--output-format {txt,json,json-v2,srt}] --job-id JOB_ID [--force]
+speechmatics batch delete [-h] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE] [--output-format {txt,json,json-v2,srt}] --job-id JOB_ID [--force]
@@ -565,13 +619,11 @@ Named Arguments
transcribe¶
Real-time commands. RETAINED FOR LEGACY COMPATIBILITY.
-speechmatics transcribe [-h] [--enable-partials] [--punctuation-sensitivity PUNCTUATION_SENSITIVITY] [--speaker-diarization-max-speakers SPEAKER_DIARIZATION_MAX_SPEAKERS]
- [--speaker-change-sensitivity SPEAKER_CHANGE_SENSITIVITY] [--speaker-change-token] [--max-delay MAX_DELAY] [--max-delay-mode {fixed,flexible}]
- [--raw ENCODING] [--sample-rate SAMPLE_RATE] [--chunk-size CHUNK_SIZE] [--buffer-size BUFFER_SIZE] [--print-json]
- [--diarization {none,speaker,speaker_change}] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token]
- [--profile PROFILE] [--config-file CONFIG_FILE] [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN] [--output-locale LOCALE]
- [--additional-vocab [ADDITIONAL_VOCAB ...]] [--additional-vocab-file VOCAB_FILEPATH] [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS]
- [--enable-entities] [--translation-langs TRANSLATION_TARGET_LANGUAGES] [--langid-langs LANGID_EXPECTED_LANGUAGES]
+speechmatics transcribe [-h] [--streaming-mode] [--enable-partials] [--enable-transcription-partials] [--enable-translation-partials] [--punctuation-sensitivity PUNCTUATION_SENSITIVITY] [--speaker-diarization-max-speakers SPEAKER_DIARIZATION_MAX_SPEAKERS]
+ [--speaker-change-sensitivity SPEAKER_CHANGE_SENSITIVITY] [--speaker-change-token] [--max-delay MAX_DELAY] [--max-delay-mode {fixed,flexible}] [--raw ENCODING] [--sample-rate SAMPLE_RATE] [--chunk-size CHUNK_SIZE]
+ [--buffer-size BUFFER_SIZE] [--print-json] [--diarization {none,speaker,speaker_change}] [--url URL] [--auth-token AUTH_TOKEN] [--ssl-mode {regular,insecure,none}] [--generate-temp-token] [--profile PROFILE] [--config-file CONFIG_FILE]
+ [--lang LANGUAGE] [--operating-point {standard,enhanced}] [--domain DOMAIN] [--output-locale LOCALE] [--additional-vocab [ADDITIONAL_VOCAB [ADDITIONAL_VOCAB ...]]] [--additional-vocab-file VOCAB_FILEPATH]
+ [--punctuation-permitted-marks PUNCTUATION_PERMITTED_MARKS] [--enable-entities] [--translation-langs TRANSLATION_TARGET_LANGUAGES] [--langid-langs LANGID_EXPECTED_LANGUAGES]
FILEPATHS [FILEPATHS ...]
@@ -586,10 +638,22 @@ Positional Arguments
Named Arguments¶
+- --streaming-mode
+Whether to run the engine in streaming mode. Internal Speechmatics use only.
+Default: False
+
- --enable-partials
+Whether to return partials for both transcripts and translation which can be updated by later,final transcripts.
+Default: False
+
+- --enable-transcription-partials
Whether to return partial transcripts which can be updated by later,final transcripts.
Default: False
+- --enable-translation-partials
+Whether to return partial translation which can be updated by later,final translation.
+Default: False
+
- --punctuation-sensitivity
Sensitivity level for advanced punctuation.
@@ -709,7 +773,7 @@ Sub-commands
set¶
Set config for the local CLI environment.
-speechmatics config set [-h] [--auth-token AUTH_TOKEN] [--generate-temp-token] [--profile PROFILE]
+speechmatics config set [-h] [--auth-token AUTH_TOKEN] [--realtime-url REALTIME_URL] [--batch-url BATCH_URL] [--generate-temp-token] [--profile PROFILE]
@@ -718,6 +782,12 @@ Named Arguments
unset¶
Remove specified config values from the CLI config file.
-speechmatics config unset [-h] [--auth-token] [--generate-temp-token] [--profile PROFILE]
+speechmatics config unset [-h] [--auth-token] [--generate-temp-token] [--profile PROFILE] [--realtime-url] [--batch-url]
@@ -750,6 +820,14 @@ Named ArgumentsSpecifies the profile to unset the config for.Profiles can be used to maintain multiple different sets of config locally.
Default: “default”
+- --realtime-url, --rt-url
+Remove the default URL to use for RT transcription.
+Default: False
+
+- --batch-url
+Remove the default URL to use for Batch transcription.
+Default: False
+
diff --git a/docs/genindex.html b/docs/genindex.html
index 990573c..bd6bb9b 100644
--- a/docs/genindex.html
+++ b/docs/genindex.html
@@ -138,15 +138,19 @@ C
- ClientMessageType (class in speechmatics.models)
-
-
+
@@ -378,6 +382,10 @@ S
- semaphore_timeout_seconds (speechmatics.models.ConnectionSettings attribute)
- send_request() (speechmatics.batch_client.BatchClient method)
+
+ - sentiment_analysis_config (speechmatics.models.BatchTranscriptionConfig attribute)
+
+ - SentimentAnalysisConfig (class in speechmatics.models)
- ServerMessageType (class in speechmatics.models)
@@ -407,8 +415,6 @@ S
- module
-
-
-
speechmatics.constants
@@ -416,6 +422,8 @@
S
- module
+
+
-
speechmatics.exceptions
@@ -446,8 +454,18 @@
S
- StartRecognition (speechmatics.models.ClientMessageType attribute)
- stop() (speechmatics.client.WebsocketClient method)
+
+ - streaming_mode (speechmatics.models.TranscriptionConfig attribute)
- submit_job() (speechmatics.batch_client.BatchClient method)
+
+ - summarization_config (speechmatics.models.BatchTranscriptionConfig attribute)
+
+ - SummarizationConfig (class in speechmatics.models)
+
+ - summary_length (speechmatics.models.SummarizationConfig attribute)
+
+ - summary_type (speechmatics.models.SummarizationConfig attribute)
@@ -457,12 +475,18 @@ T
- target_languages (speechmatics.models.TranslationConfig attribute)
- - TranscriptionConfig (class in speechmatics.models)
+
- topic_detection_config (speechmatics.models.BatchTranscriptionConfig attribute)
- - TranscriptionError
+
- TopicDetectionConfig (class in speechmatics.models)
+
+ - topics (speechmatics.models.TopicDetectionConfig attribute)
+ - TranscriptionConfig (class in speechmatics.models)
+
+ - TranscriptionError
+
- translation_config (speechmatics.models.BatchTranscriptionConfig attribute)
diff --git a/docs/models.html b/docs/models.html
index 7983672..89180bf 100644
--- a/docs/models.html
+++ b/docs/models.html
@@ -124,7 +124,7 @@
-
-class speechmatics.models.BatchConnectionSettings(url: str, message_buffer_size: int = 512, ssl_context: ssl.SSLContext = <factory>, semaphore_timeout_seconds: float = 120, ping_timeout_seconds: float = 60, auth_token: str = None, generate_temp_token: Optional[bool] = False)[source]¶
+class speechmatics.models.BatchConnectionSettings(url: str, message_buffer_size: int = 512, ssl_context: ssl.SSLContext = <factory>, semaphore_timeout_seconds: float = 120, ping_timeout_seconds: float = 60, auth_token: Union[str, NoneType] = None, generate_temp_token: Union[bool, NoneType] = False)[source]¶
@@ -182,6 +182,12 @@
Optional configuration for callback notification.
+
+-
+sentiment_analysis_config: Optional[speechmatics.models.SentimentAnalysisConfig] = None¶
+Optional configuration for sentiment analysis of the transcript
+
+
-
speaker_diarization_config: speechmatics.models.BatchSpeakerDiarizationConfig = None¶
@@ -194,6 +200,18 @@
Optional configuration for SRT output.
+
+-
+summarization_config: speechmatics.models.SummarizationConfig = None¶
+Optional configuration for transcript summarization.
+
+
+
+-
+topic_detection_config: Optional[speechmatics.models.TopicDetectionConfig] = None¶
+Optional configuration for detecting topics of the transcript
+
+
-
translation_config: speechmatics.models.TranslationConfig = None¶
@@ -245,7 +263,7 @@
Defines connection parameters.
@@ -310,11 +328,11 @@
-
-class speechmatics.models.NotificationConfig(url: str, contents: Optional[str] = None, method: str = 'post', auth_headers: Optional[str] = None)[source]¶
+class speechmatics.models.NotificationConfig(url: str, contents: Optional[List[str]] = None, method: str = 'post', auth_headers: Optional[List[str]] = None)[source]¶
Batch: Optional configuration for callback notification.
-
-auth_headers: str = None¶
+auth_headers: List[str] = None¶
A list of additional headers to be added to the notification request
when using http or https. This is intended to support authentication or
authorization, for example by supplying an OAuth2 bearer token
@@ -322,7 +340,7 @@
-
-contents: str = None¶
+contents: List[str] = None¶
Specifies a list of items to be attached to the notification message.
When multiple items are requested, they are included as named file
attachments.
@@ -344,7 +362,7 @@
-
-class speechmatics.models.RTConnectionSettings(url: str, message_buffer_size: int = 512, ssl_context: ssl.SSLContext = <factory>, semaphore_timeout_seconds: float = 120, ping_timeout_seconds: float = 60, auth_token: str = None, generate_temp_token: Optional[bool] = False)[source]¶
+class speechmatics.models.RTConnectionSettings(url: str, message_buffer_size: int = 512, ssl_context: ssl.SSLContext = <factory>, semaphore_timeout_seconds: float = 120, ping_timeout_seconds: float = 60, auth_token: Union[str, NoneType] = None, generate_temp_token: Union[bool, NoneType] = False)[source]¶
@@ -390,6 +408,12 @@
+
+
+
+-
+class speechmatics.models.SummarizationConfig(content_type: Literal['informative', 'conversational', 'auto'] = 'auto', summary_length: Literal['brief', 'detailed'] = 'brief', summary_type: Literal['paragraphs', 'bullets'] = 'bullets')[source]¶
+Defines summarization parameters.
+
+-
+content_type: Literal['informative', 'conversational', 'auto'] = 'auto'¶
+Optional summarization content_type parameter.
+
+
+
+-
+summary_length: Literal['brief', 'detailed'] = 'brief'¶
+Optional summarization summary_length parameter.
+
+
+
+-
+summary_type: Literal['paragraphs', 'bullets'] = 'bullets'¶
+Optional summarization summary_type parameter.
+
+
+
+
+
+-
+class speechmatics.models.TopicDetectionConfig(topics: Optional[List[str]] = None)[source]¶
+Defines topic detection parameters.
+
+-
+topics: List[str] = None¶
+Optional list of topics for topic detection.
+
+
+
+
-
class speechmatics.models.TranscriptionConfig(language=None, **kwargs)[source]¶
Real-time: Defines transcription parameters.
The .as_config() method removes translation_config and returns it wrapped into a Speechmatics json config.
+
+-
+ctrl: dict = None¶
+Internal Speechmatics flag that allows to give special commands to the engine.
+
+
-
enable_partials: bool = None¶
@@ -516,6 +582,12 @@
Configuration for speaker diarization.
+
+-
+streaming_mode: bool = None¶
+Indicates if we run the engine in streaming mode, or regular RT mode.
+
+
-
translation_config: speechmatics.models.TranslationConfig = None¶
diff --git a/docs/objects.inv b/docs/objects.inv
index a2bcc0d..bfee1ff 100644
Binary files a/docs/objects.inv and b/docs/objects.inv differ
diff --git a/docs/searchindex.js b/docs/searchindex.js
index 40f96b7..709efa7 100644
--- a/docs/searchindex.js
+++ b/docs/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["batch_client","cli_parser","client","constants","exceptions","helpers","index","models"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["batch_client.rst","cli_parser.rst","client.rst","constants.rst","exceptions.rst","helpers.rst","index.rst","models.rst"],objects:{"speechmatics.batch_client":[[0,1,1,"","BatchClient"],[0,1,1,"","HttpClient"]],"speechmatics.batch_client.BatchClient":[[0,2,1,"","check_job_status"],[0,2,1,"","close"],[0,2,1,"","connect"],[0,2,1,"","delete_job"],[0,2,1,"","get_job_result"],[0,2,1,"","list_jobs"],[0,2,1,"","send_request"],[0,2,1,"","submit_job"],[0,2,1,"","wait_for_completion"]],"speechmatics.batch_client.HttpClient":[[0,2,1,"","build_request"]],"speechmatics.client":[[2,1,1,"","WebsocketClient"]],"speechmatics.client.WebsocketClient":[[2,2,1,"","add_event_handler"],[2,2,1,"","add_middleware"],[2,2,1,"","get_language_pack_info"],[2,2,1,"","run"],[2,2,1,"","run_synchronously"],[2,2,1,"","stop"],[2,2,1,"","update_transcription_config"]],"speechmatics.constants":[[3,3,1,"","BATCH_SELF_SERVICE_URL"],[3,3,1,"","RT_SELF_SERVICE_URL"]],"speechmatics.exceptions":[[4,4,1,"","EndOfTranscriptException"],[4,4,1,"","ForceEndSession"],[4,4,1,"","JobNotFoundException"],[4,4,1,"","TranscriptionError"]],"speechmatics.helpers":[[5,5,1,"","del_none"],[5,5,1,"","get_version"],[5,5,1,"","json_utf8"],[5,5,1,"","read_in_chunks"]],"speechmatics.models":[[7,1,1,"","AudioSettings"],[7,1,1,"","BatchConnectionSettings"],[7,1,1,"","BatchLanguageIdentificationConfig"],[7,1,1,"","BatchSpeakerDiarizationConfig"],[7,1,1,"","BatchTranscriptionConfig"],[7,1,1,"","BatchTranslationConfig"],[7,1,1,"","ClientMessageType"],[7,1,1,"","ConnectionSettings"],[7,1,1,"","FetchData"],[7,1,1,"","NotificationConfig"],[7,1,1,"","RTConnectionSettings"],[7,1,1,"","RTSpeakerDiarizationConfig"],[7,1,1,"","RTTranslationConfig"],[7,1,1,"","SRTOverrides"],[7,1,1,"","ServerMessageType"],[7,1,1,"","TranscriptionConfig"],[7,1,1,"","TranslationConfig"],[7,1,1,"","UsageMode"],[7,1,1,"","_TranscriptionConfig"]],"speechmatics.models.AudioSettings":[[7,6,1,"","chunk_size"],[7,6,1,"","encoding"],[7,6,1,"","sample_rate"]],"speechmatics.models.BatchLanguageIdentificationConfig":[[7,6,1,"","expected_languages"]],"speechmatics.models.BatchSpeakerDiarizationConfig":[[7,6,1,"","speaker_sensitivity"]],"speechmatics.models.BatchTranscriptionConfig":[[7,6,1,"","channel_diarization_labels"],[7,6,1,"","fetch_data"],[7,6,1,"","language_identification_config"],[7,6,1,"","notification_config"],[7,6,1,"","speaker_diarization_config"],[7,6,1,"","srt_overrides"],[7,6,1,"","translation_config"]],"speechmatics.models.ClientMessageType":[[7,6,1,"","AddAudio"],[7,6,1,"","EndOfStream"],[7,6,1,"","SetRecognitionConfig"],[7,6,1,"","StartRecognition"]],"speechmatics.models.ConnectionSettings":[[7,6,1,"","auth_token"],[7,6,1,"","generate_temp_token"],[7,6,1,"","message_buffer_size"],[7,6,1,"","ping_timeout_seconds"],[7,6,1,"","semaphore_timeout_seconds"],[7,6,1,"","ssl_context"],[7,6,1,"","url"]],"speechmatics.models.FetchData":[[7,6,1,"","auth_headers"],[7,6,1,"","url"]],"speechmatics.models.NotificationConfig":[[7,6,1,"","auth_headers"],[7,6,1,"","contents"],[7,6,1,"","method"],[7,6,1,"","url"]],"speechmatics.models.RTSpeakerDiarizationConfig":[[7,6,1,"","max_speakers"]],"speechmatics.models.RTTranslationConfig":[[7,6,1,"","enable_partials"]],"speechmatics.models.SRTOverrides":[[7,6,1,"","max_line_length"],[7,6,1,"","max_lines"]],"speechmatics.models.ServerMessageType":[[7,6,1,"","AddPartialTranscript"],[7,6,1,"","AddPartialTranslation"],[7,6,1,"","AddTranscript"],[7,6,1,"","AddTranslation"],[7,6,1,"","AudioAdded"],[7,6,1,"","EndOfTranscript"],[7,6,1,"","Error"],[7,6,1,"","Info"],[7,6,1,"","RecognitionStarted"],[7,6,1,"","Warning"]],"speechmatics.models.TranscriptionConfig":[[7,6,1,"","enable_partials"],[7,6,1,"","enable_transcription_partials"],[7,6,1,"","enable_translation_partials"],[7,6,1,"","max_delay"],[7,6,1,"","max_delay_mode"],[7,6,1,"","speaker_change_sensitivity"],[7,6,1,"","speaker_diarization_config"],[7,6,1,"","translation_config"]],"speechmatics.models.TranslationConfig":[[7,6,1,"","target_languages"]],"speechmatics.models._TranscriptionConfig":[[7,6,1,"","additional_vocab"],[7,2,1,"","asdict"],[7,6,1,"","diarization"],[7,6,1,"","domain"],[7,6,1,"","enable_entities"],[7,6,1,"","language"],[7,6,1,"","operating_point"],[7,6,1,"","output_locale"],[7,6,1,"","punctuation_overrides"]],speechmatics:[[0,0,0,"-","batch_client"],[2,0,0,"-","client"],[3,0,0,"-","constants"],[4,0,0,"-","exceptions"],[5,0,0,"-","helpers"],[7,0,0,"-","models"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","data","Python data"],"4":["py","exception","Python exception"],"5":["py","function","Python function"],"6":["py","attribute","Python attribute"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:data","4":"py:exception","5":"py:function","6":"py:attribute"},terms:{"0":[0,1,7],"1":[1,7],"100":[0,1],"12":1,"120":7,"168":1,"192":1,"2":[1,7],"20":1,"37":7,"404":0,"4096":[1,2,7],"44100":[1,2,7],"5":1,"512":[1,7],"5646":7,"60":7,"639":[1,7],"7":[0,1],"8":1,"9000":[1,2],"boolean":2,"byte":[0,1,5,7],"case":5,"class":[0,1,2,7],"default":[0,1],"final":[1,7],"float":7,"function":[2,5],"import":6,"int":[5,7],"new":2,"return":[0,1,2,5,7],"true":[0,1,6,7],"while":[1,7],A:[2,5,7],FOR:1,For:[0,2],If:[1,2],It:0,The:[0,1,2,3,6,7],With:1,_transcriptionconfig:7,about:1,accept:[0,1,7],access:6,account:1,accur:1,acknowledg:7,acoust:[1,7],ad:[2,3,7],add:[0,1,2,6,7],add_event_handl:[2,6],add_middlewar:2,addaudio:[2,7],addit:[1,7],additional_vocab:[1,7],addpartialtranscript:[6,7],addpartialtransl:7,addtranscript:[2,6,7],addtransl:7,advanc:[0,1,7],after:7,afterward:0,alia:0,all:[0,1,2,5,7],allow:[1,7],also:0,alter:2,an:[0,1,2,4,6,7],ani:[0,2,7],anymor:1,api:[0,1,2,3,6],appli:1,applianc:[0,1],ar:[0,1,2,5,7],arg:[0,2],argument:[0,2,6],around:0,as_config:7,asdict:7,asr:[0,1,2,3],associ:0,async:[2,5],asynchron:2,asyncio:2,asynciter:5,attach:7,au:7,audio:[0,1,2,5,6,7],audio_file_path:6,audio_set:2,audioad:7,audioset:[2,6,7],auth:[1,7],auth_head:7,auth_token:[0,1,6,7],authent:[1,7],author:[1,7],automat:[1,7],avail:[3,7],base:[2,7],base_url:0,batch:[0,3,6,7],batch_client:6,batch_self_service_url:3,batchclient:0,batchconnectionset:7,batchlanguageidentificationconfig:7,batchspeakerdiarizationconfig:7,batchtranscriptionconfig:[0,7],batchtranslationconfig:7,bearer:7,becom:7,been:[2,7],befor:1,begin:2,being:[2,6],below:6,best:2,between:7,binari:2,block:[0,2],bool:[0,2,7],both:7,buffer:[1,7],buffer_s:1,build:0,build_request:0,call:2,callabl:2,callback:[2,7],caller:2,can:[1,2,4,7],cancel:0,certif:1,chang:[1,5,7],channel:[1,7],channel_and_speaker_chang:1,channel_diarization_label:[1,7],charact:7,check:0,check_job_statu:0,choic:1,chunk:[1,5,7],chunk_siz:[1,2,5,7],clean:0,cli:6,client:[0,1,6,7],clientmessagetyp:7,close:0,code:[1,7],collect:5,com:[1,3,6],comma:1,command:2,compat:1,complet:[0,7],computation:1,conf:6,config:[0,2,7],config_fil:1,configur:[0,1,2,7],confirm:7,conjunct:2,connect:[0,2,7],connection_set:2,connection_settings_or_auth_token:[0,2],connection_url:6,connectionset:[0,2,6,7],consol:1,constant:3,consum:2,content:[1,7],context:[0,1,7],cooki:0,copi:2,count:7,creat:[0,1,6],custom:[1,3,6,7],dai:[0,1],data:[1,2,5,7],de:1,debug:1,decor:5,def:6,defin:[6,7],del_non:5,delai:[1,7],delet:[0,5],delete_job:0,detect:[1,7],determin:[1,7],diariz:[1,7],dict:[0,2,5,7],dictionari:5,differ:1,directli:0,doc:2,doe:0,doesn:3,domain:[1,7],don:[2,6],e:[0,1,2,7],each:[1,5],earli:4,eg:[1,7],en:[1,2,6,7],enabl:[1,7],enable_ent:7,enable_parti:[6,7],enable_transcription_parti:7,enable_translation_parti:7,encod:[1,2,7],encodingof:1,end:[2,3,4,7],endofstream:7,endoftranscript:7,endoftranscriptexcept:4,endpoint:[0,7],enforc:[1,7],enhanc:1,enterpris:[1,3,6,7],entiti:[1,7],entri:5,enumer:7,environ:1,error:[0,4,7],eu2:[3,6],event:[2,4,6],event_handl:[2,6],event_nam:[2,6],everi:2,exampl:[1,2,7],exceed:[2,7],except:[0,2,6],exclud:7,exist:0,expect:[1,7],expected_languag:7,expens:1,expliticli:0,expos:2,f:6,factori:7,fail:0,fals:[0,1,2,7],fetch:7,fetch_data:7,fetch_url:0,fetchdata:7,field:2,file:[0,1,2,5,6,7],filenam:0,filepath:1,financ:[1,7],finish:[2,4,7],first:2,fix:[1,7],flag:1,flexibl:[1,7],foracknowledg:1,forc:[0,1,4],forceendsess:4,forcefulli:2,format:[0,1,7],found:[0,4,5],fr:1,from:[1,2,4,5,7],from_cli:[0,2],full:6,func:5,g:[0,1,7],gener:[1,7],generate_temp_token:[1,6,7],get:2,get_job_result:0,get_language_pack_info:2,get_vers:5,github:6,given:2,global:1,gnocchi:1,h:1,ha:[2,4,7],handl:[0,1,2],handler:[2,4,6],have:3,header:[0,7],helper:6,here:6,hertz:7,how:1,html:2,http:[0,1,2,3,7],httpclient:0,httperror:0,httpx:0,hz:1,i:2,id:[0,1,4,7],identif:[1,7],ignor:7,illustr:6,immedi:7,impli:2,includ:[2,7],incom:2,incomplet:7,increas:1,index:6,indic:[1,2,4,7],info:[1,7],inform:[1,2,5],initi:7,input:[1,5,7],insecur:1,instanc:0,instanti:2,intend:7,interact:2,interfac:[0,2],interpret:1,inth:1,invalid:0,invers:7,io:[2,5],iobas:[2,5],iso:[1,7],item:7,job:[0,4,7],job_id:[0,1],jobnotfoundexcept:[0,4],json:[0,1,5,7],json_utf8:5,just:2,kwarg:[0,2,7],label1:1,label2:1,label:[1,7],lambda:2,lang:1,langid:1,langid_expected_languag:1,languag:[1,2,3,6,7],language_identification_config:7,language_pack_info:2,larger:1,last:[0,1],latenc:1,later:1,latest:2,least:7,legaci:1,length:5,level:[1,7],librari:[0,2,3,4,5,7],like:[1,2,5],line:[1,2,7],list:[0,2,7],list_job:0,list_of_job:0,local:1,localhost:2,log:1,mai:[0,2,7],maintain:1,manag:[0,2],manifest:2,mark:[1,7],max:1,max_delai:[1,7],max_delay_mod:7,max_lin:7,max_line_length:7,max_sample_s:5,max_speak:7,maximum:[1,5,7],mean:7,merg:0,messag:[1,2,7],message_buffer_s:7,metadata:6,method:[0,5,7],middl:1,middlewar:[2,4],min:1,mode:[6,7],model:[0,1,2,6],modul:6,more:[1,7],most:[2,7],msg:[2,6],much:1,mulaw:7,multipl:[1,5,7],must:[0,1,7],n:7,name:[2,6,7],need:[2,6],new_transcription_config:2,nochi:1,nokei:1,non:[1,3,7],none:[0,1,2,5,7],normal:7,note:[0,3],notif:7,notification_config:7,notificationconfig:7,number:[1,5,7],oauth2:7,object:[0,2,5],one:1,onli:[1,2,7],open:[0,6],oper:1,operating_point:7,optim:7,option:[0,1,2,7],order:4,os:0,other:[0,1],out:2,outgo:2,output:[1,5,7],output_local:7,overhead:1,overrid:1,overriden:7,own:[1,7],pack:[1,2,7],packag:5,page:6,param:0,paramet:[0,2,5,6,7],part:[6,7],partial:[1,6,7],particular:2,pass:[0,2],path:[0,6],pathlik:0,pcm_f32le:[1,7],pcm_s16le:7,per:7,permit:[1,7],piec:1,ping:7,ping_timeout_second:7,place:5,plaintext:1,pleas:6,point:1,pong:7,pool:0,possibl:[1,2],post:7,potenti:7,pre:1,prefer:2,preset:1,previous:[0,7],print:[1,2,6],print_partial_transcript:6,print_transcript:6,probabl:2,process:[1,2],produc:[2,7],producer_consum:2,product:1,profil:1,provid:[0,1,6],puctuat:7,punctuat:[1,7],punctuation_overrid:7,punctuation_permitted_mark:1,punctuation_sensit:1,put:7,queri:[0,7],rais:[0,2,4,5],rate:[1,7],rather:1,raw:[1,7],rb:6,re:[2,7],read:[1,2,5],read_in_chunk:5,readm:6,readthedoc:2,real:[1,2,7],realtim:[3,6],receipt:7,receiv:[1,2],recognisedent:1,recognit:[2,7],recognitionstart:[2,7],recurs:[5,7],redirect:1,refer:2,regist:6,regular:1,remov:[1,7],repres:1,request:[0,1,7],requir:[0,1],respect:1,respond:2,respons:[0,7],rest:0,result:[0,2],retain:1,retriev:1,rfc:7,rt:[3,6],rt_self_service_url:3,rtconnectionset:7,rtspeakerdiarizationconfig:7,rttranslationconfig:7,run:[0,1,2],run_synchron:[2,6],s:[1,5,7],saa:[0,1],sampl:[1,7],sample_r:[1,2,7],sc:1,sdk:0,search:6,second:[2,7],section:7,see:[0,6],select:1,self:[1,3],semaphor:7,semaphore_timeout_second:7,send:[0,1,7],send_request:0,sensit:[1,7],sent:[2,7],sentenc:7,separ:1,sequenc:5,server:[1,2,7],servermessagetyp:[2,6,7],servic:3,session:[2,4,7],set:[0,2,6,7],setrecognitionconfig:[2,7],setup:1,share:1,should:[1,2,7],show:1,sign:1,simpl:[1,2],singl:[1,7],size:[1,5,7],sm:0,small:1,sound:1,sourc:[0,2,4,5,7],space:[1,7],speaker:[1,7],speaker_chang:1,speaker_change_sensit:[1,7],speaker_diarization_config:7,speaker_diarization_max_speak:1,speaker_diarization_sensit:1,speaker_sensit:7,special:1,specif:7,specifi:[1,7],speech:1,srt:[0,1,7],srt_overrid:7,srtoverrid:7,ssl:[1,7],ssl_context:7,sslcontext:7,standard:[1,7],start:7,startrecognit:7,statu:[0,7],stderr:1,stdout:1,still:0,stop:2,str:[0,2,5,7],stream:[1,2,5,7],sub:6,submit:0,submit_job:0,subset:2,subtitl:7,successfulli:7,suppli:7,support:7,symbol:1,synchron:2,t:[2,3,6],target:7,target_languag:7,task:2,temp:1,temporari:[1,7],termin:0,text:7,than:[0,1],thei:[2,7],thi:[0,1,2,5,6,7],threshold:7,time:[1,2,7],timeout:[2,7],timeouterror:2,token:[1,6,7],toml:1,too:1,tool:6,transcrib:6,transcript:[0,1,2,4,6,7],transcription_config:[0,2],transcription_format:0,transcriptionconfig:[2,6,7],transcriptionerror:[0,4],translat:[1,7],translation_config:7,translation_target_languag:1,translationconfig:7,tupl:0,turn:5,txt:[0,1],type:[0,1,2,5,7],unbreak:1,union:[0,2],unnecessari:1,unset:0,until:[0,2,7],up:0,updat:[1,2],update_transcription_config:2,url:[0,1,2,3,6,7],us:[0,1,2,3,4,5,7],usag:1,usagemod:7,user:[1,2,4],util:5,v2:[0,1,2,3,6],v:1,valid:[0,1,2],valu:[0,1,5,7],valueerror:[2,5],variou:7,verbos:1,version:5,via:2,vocab:1,vocab_filepath:1,vocabulari:7,vv:1,wa:[1,4,5],wai:2,wait:1,wait_for_complet:0,warn:7,wav:6,waveform:6,we:[0,2],websocket:[1,2,7],websocketcli:[2,6],when:[0,1,2,7],where:[1,5,7],wherev:1,whether:[1,2,7],which:[0,1,2,5,7],white:7,wire:1,within:[0,1,7],word:7,work:1,would:7,wrap:7,wrapper:[0,2,6],ws:6,wss:[1,2,3,6],yet:2,yield:5,you:[0,1,2],your:[1,7]},titles:["speechmatics.batch_client","Speechmatics CLI Tool","speechmatics.client","speechmatics.client","speechmatics.exceptions","speechmatics.helpers","speechmatics-python","speechmatics.models"],titleterms:{argument:1,batch:1,batch_client:0,cli:1,client:[2,3],command:[1,6],config:1,delet:1,exampl:6,except:4,get:1,helper:5,indic:6,job:1,librari:6,line:6,list:1,mode:1,model:7,name:1,posit:1,python:6,refer:6,result:1,rt:1,set:1,speechmat:[0,1,2,3,4,5,6,7],statu:1,sub:1,submit:1,tabl:6,tool:1,transcrib:1,unset:1,usag:6}})
\ No newline at end of file
+Search.setIndex({docnames:["batch_client","cli_parser","client","constants","exceptions","helpers","index","models"],envversion:{"sphinx.domains.c":2,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":4,"sphinx.domains.index":1,"sphinx.domains.javascript":2,"sphinx.domains.math":2,"sphinx.domains.python":3,"sphinx.domains.rst":2,"sphinx.domains.std":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["batch_client.rst","cli_parser.rst","client.rst","constants.rst","exceptions.rst","helpers.rst","index.rst","models.rst"],objects:{"speechmatics.batch_client":[[0,1,1,"","BatchClient"],[0,1,1,"","HttpClient"]],"speechmatics.batch_client.BatchClient":[[0,2,1,"","check_job_status"],[0,2,1,"","close"],[0,2,1,"","connect"],[0,2,1,"","delete_job"],[0,2,1,"","get_job_result"],[0,2,1,"","list_jobs"],[0,2,1,"","send_request"],[0,2,1,"","submit_job"],[0,2,1,"","wait_for_completion"]],"speechmatics.batch_client.HttpClient":[[0,2,1,"","build_request"]],"speechmatics.client":[[2,1,1,"","WebsocketClient"]],"speechmatics.client.WebsocketClient":[[2,2,1,"","add_event_handler"],[2,2,1,"","add_middleware"],[2,2,1,"","get_language_pack_info"],[2,2,1,"","run"],[2,2,1,"","run_synchronously"],[2,2,1,"","stop"],[2,2,1,"","update_transcription_config"]],"speechmatics.constants":[[3,3,1,"","BATCH_SELF_SERVICE_URL"],[3,3,1,"","RT_SELF_SERVICE_URL"]],"speechmatics.exceptions":[[4,4,1,"","EndOfTranscriptException"],[4,4,1,"","ForceEndSession"],[4,4,1,"","JobNotFoundException"],[4,4,1,"","TranscriptionError"]],"speechmatics.helpers":[[5,5,1,"","del_none"],[5,5,1,"","get_version"],[5,5,1,"","json_utf8"],[5,5,1,"","read_in_chunks"]],"speechmatics.models":[[7,1,1,"","AudioSettings"],[7,1,1,"","BatchConnectionSettings"],[7,1,1,"","BatchLanguageIdentificationConfig"],[7,1,1,"","BatchSpeakerDiarizationConfig"],[7,1,1,"","BatchTranscriptionConfig"],[7,1,1,"","BatchTranslationConfig"],[7,1,1,"","ClientMessageType"],[7,1,1,"","ConnectionSettings"],[7,1,1,"","FetchData"],[7,1,1,"","NotificationConfig"],[7,1,1,"","RTConnectionSettings"],[7,1,1,"","RTSpeakerDiarizationConfig"],[7,1,1,"","RTTranslationConfig"],[7,1,1,"","SRTOverrides"],[7,1,1,"","SentimentAnalysisConfig"],[7,1,1,"","ServerMessageType"],[7,1,1,"","SummarizationConfig"],[7,1,1,"","TopicDetectionConfig"],[7,1,1,"","TranscriptionConfig"],[7,1,1,"","TranslationConfig"],[7,1,1,"","UsageMode"],[7,1,1,"","_TranscriptionConfig"]],"speechmatics.models.AudioSettings":[[7,6,1,"","chunk_size"],[7,6,1,"","encoding"],[7,6,1,"","sample_rate"]],"speechmatics.models.BatchLanguageIdentificationConfig":[[7,6,1,"","expected_languages"]],"speechmatics.models.BatchSpeakerDiarizationConfig":[[7,6,1,"","speaker_sensitivity"]],"speechmatics.models.BatchTranscriptionConfig":[[7,6,1,"","channel_diarization_labels"],[7,6,1,"","fetch_data"],[7,6,1,"","language_identification_config"],[7,6,1,"","notification_config"],[7,6,1,"","sentiment_analysis_config"],[7,6,1,"","speaker_diarization_config"],[7,6,1,"","srt_overrides"],[7,6,1,"","summarization_config"],[7,6,1,"","topic_detection_config"],[7,6,1,"","translation_config"]],"speechmatics.models.ClientMessageType":[[7,6,1,"","AddAudio"],[7,6,1,"","EndOfStream"],[7,6,1,"","SetRecognitionConfig"],[7,6,1,"","StartRecognition"]],"speechmatics.models.ConnectionSettings":[[7,6,1,"","auth_token"],[7,6,1,"","generate_temp_token"],[7,6,1,"","message_buffer_size"],[7,6,1,"","ping_timeout_seconds"],[7,6,1,"","semaphore_timeout_seconds"],[7,6,1,"","ssl_context"],[7,6,1,"","url"]],"speechmatics.models.FetchData":[[7,6,1,"","auth_headers"],[7,6,1,"","url"]],"speechmatics.models.NotificationConfig":[[7,6,1,"","auth_headers"],[7,6,1,"","contents"],[7,6,1,"","method"],[7,6,1,"","url"]],"speechmatics.models.RTSpeakerDiarizationConfig":[[7,6,1,"","max_speakers"]],"speechmatics.models.RTTranslationConfig":[[7,6,1,"","enable_partials"]],"speechmatics.models.SRTOverrides":[[7,6,1,"","max_line_length"],[7,6,1,"","max_lines"]],"speechmatics.models.ServerMessageType":[[7,6,1,"","AddPartialTranscript"],[7,6,1,"","AddPartialTranslation"],[7,6,1,"","AddTranscript"],[7,6,1,"","AddTranslation"],[7,6,1,"","AudioAdded"],[7,6,1,"","EndOfTranscript"],[7,6,1,"","Error"],[7,6,1,"","Info"],[7,6,1,"","RecognitionStarted"],[7,6,1,"","Warning"]],"speechmatics.models.SummarizationConfig":[[7,6,1,"","content_type"],[7,6,1,"","summary_length"],[7,6,1,"","summary_type"]],"speechmatics.models.TopicDetectionConfig":[[7,6,1,"","topics"]],"speechmatics.models.TranscriptionConfig":[[7,6,1,"","ctrl"],[7,6,1,"","enable_partials"],[7,6,1,"","enable_transcription_partials"],[7,6,1,"","enable_translation_partials"],[7,6,1,"","max_delay"],[7,6,1,"","max_delay_mode"],[7,6,1,"","speaker_change_sensitivity"],[7,6,1,"","speaker_diarization_config"],[7,6,1,"","streaming_mode"],[7,6,1,"","translation_config"]],"speechmatics.models.TranslationConfig":[[7,6,1,"","target_languages"]],"speechmatics.models._TranscriptionConfig":[[7,6,1,"","additional_vocab"],[7,2,1,"","asdict"],[7,6,1,"","diarization"],[7,6,1,"","domain"],[7,6,1,"","enable_entities"],[7,6,1,"","language"],[7,6,1,"","operating_point"],[7,6,1,"","output_locale"],[7,6,1,"","punctuation_overrides"]],speechmatics:[[0,0,0,"-","batch_client"],[2,0,0,"-","client"],[3,0,0,"-","constants"],[4,0,0,"-","exceptions"],[5,0,0,"-","helpers"],[7,0,0,"-","models"]]},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","data","Python data"],"4":["py","exception","Python exception"],"5":["py","function","Python function"],"6":["py","attribute","Python attribute"]},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:data","4":"py:exception","5":"py:function","6":"py:attribute"},terms:{"0":[0,1,7],"1":[1,7],"100":[0,1],"12":1,"120":7,"168":1,"192":1,"2":[1,7],"20":1,"37":7,"404":0,"4096":[1,2,7],"44100":[1,2,7],"5":1,"512":[1,7],"5646":7,"60":7,"639":[1,7],"7":[0,1],"8":1,"9000":[1,2],"boolean":2,"byte":[0,1,5,7],"case":5,"class":[0,1,2,7],"default":[0,1],"final":[1,7],"float":7,"function":[2,5],"import":6,"int":[5,7],"new":2,"return":[0,1,2,5,7],"true":[0,1,6,7],"while":[1,7],A:[2,5,7],FOR:1,For:[0,2],If:[1,2],It:0,The:[0,1,2,3,6,7],With:1,_transcriptionconfig:7,about:1,accept:[0,1,7],access:6,account:1,accur:1,acknowledg:7,acoust:[1,7],ad:[2,3,7],add:[0,1,2,6,7],add_event_handl:[2,6],add_middlewar:2,addaudio:[2,7],addit:[1,7],additional_vocab:[1,7],addpartialtranscript:[6,7],addpartialtransl:7,addtranscript:[2,6,7],addtransl:7,advanc:[0,1,7],after:7,afterward:0,alia:0,all:[0,1,2,5,7],allow:[1,7],also:0,alter:2,an:[0,1,2,4,6,7],analysi:[1,7],ani:[0,2,7],anymor:1,api:[0,1,2,3,6],appli:1,applianc:[0,1],ar:[0,1,2,5,7],arg:[0,2],argument:[0,2,6],around:0,as_config:7,asdict:7,asr:[0,1,2,3],associ:0,async:[2,5],asynchron:2,asyncio:2,asynciter:5,attach:7,au:7,audio:[0,1,2,5,6,7],audio_file_path:6,audio_set:2,audioad:7,audioset:[2,6,7],auth:[1,7],auth_head:7,auth_token:[0,1,6,7],authent:[1,7],author:[1,7],auto:[1,7],automat:[1,7],avail:[3,7],base:[2,7],base_url:0,batch:[0,3,6,7],batch_client:6,batch_self_service_url:3,batch_url:1,batchclient:0,batchconnectionset:7,batchlanguageidentificationconfig:7,batchspeakerdiarizationconfig:7,batchtranscriptionconfig:[0,7],batchtranslationconfig:7,bearer:7,becom:7,been:[2,7],befor:1,begin:2,being:[2,6],below:6,best:2,between:7,binari:2,block:[0,2],bool:[0,2,7],both:[1,7],brief:[1,7],buffer:[1,7],buffer_s:1,build:0,build_request:0,bullet:[1,7],call:2,callabl:2,callback:[2,7],caller:2,can:[1,2,4,7],cancel:0,certif:1,chang:[1,5,7],channel:[1,7],channel_and_speaker_chang:1,channel_diarization_label:[1,7],charact:7,check:0,check_job_statu:0,choic:1,chunk:[1,5,7],chunk_siz:[1,2,5,7],clean:0,cli:6,client:[0,1,6,7],clientmessagetyp:7,close:0,code:[1,7],collect:5,com:[1,3,6],comma:1,command:[2,7],compat:1,complet:[0,7],computation:1,conf:6,config:[0,2,7],config_fil:1,configur:[0,1,2,7],confirm:7,conjunct:2,connect:[0,2,7],connection_set:2,connection_settings_or_auth_token:[0,2],connection_url:6,connectionset:[0,2,6,7],consol:1,constant:3,consum:2,content:[1,7],content_typ:7,context:[0,1,7],convers:[1,7],cooki:0,copi:2,count:7,creat:[0,1,6],ctrl:[1,7],custom:[1,3,6,7],dai:[0,1],data:[1,2,5,7],de:1,debug:1,decor:5,def:6,defin:[6,7],del_non:5,delai:[1,7],delet:[0,5],delete_job:0,detail:[1,7],detect:[1,7],determin:[1,7],diariz:[1,7],dict:[0,2,5,7],dictionari:5,differ:1,directli:0,doc:2,doe:0,doesn:3,domain:[1,7],don:[2,6],e:[0,1,2,7],each:[1,5],earli:4,eg:[1,7],en:[1,2,6,7],enabl:[1,7],enable_ent:7,enable_parti:[6,7],enable_transcription_parti:7,enable_translation_parti:7,encod:[1,2,7],encodingof:1,end:[2,3,4,7],endofstream:7,endoftranscript:7,endoftranscriptexcept:4,endpoint:[0,7],enforc:[1,7],engin:[1,7],enhanc:1,enterpris:[1,3,6,7],entiti:[1,7],entri:5,enumer:7,environ:1,error:[0,4,7],eu2:[3,6],event:[2,4,6],event_handl:[2,6],event_nam:[2,6],everi:2,exampl:[1,2,7],exceed:[2,7],except:[0,2,6],exclud:7,exist:0,expect:[1,7],expected_languag:7,expens:1,expliticli:0,expos:2,f:6,factori:7,fail:0,fals:[0,1,2,7],fetch:7,fetch_data:7,fetch_url:0,fetchdata:7,field:2,file:[0,1,2,5,6,7],filenam:0,filepath:1,financ:[1,7],finish:[2,4,7],first:2,fix:[1,7],flag:[1,7],flexibl:[1,7],foracknowledg:1,forc:[0,1,4],forceendsess:4,forcefulli:2,format:[0,1,7],found:[0,4,5],fr:1,from:[1,2,4,5,7],from_cli:[0,2],full:6,func:5,g:[0,1,7],gener:[1,7],generate_temp_token:[1,6,7],get:2,get_job_result:0,get_language_pack_info:2,get_vers:5,github:6,give:7,given:2,global:1,gnocchi:1,h:1,ha:[2,4,7],handl:[0,1,2],handler:[2,4,6],have:3,header:[0,7],helper:6,here:6,hertz:7,how:1,html:2,http:[0,1,2,3,7],httpclient:0,httperror:0,httpx:0,hz:1,i:2,id:[0,1,4,7],identif:[1,7],ignor:7,illustr:6,immedi:7,impli:2,includ:[2,7],incom:2,incomplet:7,increas:1,index:6,indic:[1,2,4,7],info:[1,7],inform:[1,2,5,7],initi:7,input:[1,5,7],insecur:1,instanc:0,instanti:2,intend:7,interact:2,interfac:[0,2],intern:[1,7],interpret:1,inth:1,invalid:0,invers:7,io:[2,5],iobas:[2,5],iso:[1,7],item:7,job:[0,4,7],job_id:[0,1],jobnotfoundexcept:[0,4],json:[0,1,5,7],json_utf8:5,just:2,kwarg:[0,2,7],label1:1,label2:1,label:[1,7],lambda:2,lang:1,langid:1,langid_expected_languag:1,languag:[1,2,3,6,7],language_identification_config:7,language_pack_info:2,larger:1,last:[0,1],latenc:1,later:1,latest:2,least:7,legaci:1,length:[1,5],level:[1,7],librari:[0,2,3,4,5,7],like:[1,2,5],line:[1,2,7],list:[0,2,7],list_job:0,list_of_job:0,liter:7,local:1,localhost:2,log:1,mai:[0,2,7],maintain:1,manag:[0,2],manifest:2,mark:[1,7],max:1,max_delai:[1,7],max_delay_mod:7,max_lin:7,max_line_length:7,max_sample_s:5,max_speak:7,maximum:[1,5,7],mean:7,merg:0,messag:[1,2,7],message_buffer_s:7,metadata:6,method:[0,5,7],middl:1,middlewar:[2,4],min:1,mode:[6,7],model:[0,1,2,6],modul:6,more:[1,7],most:[2,7],msg:[2,6],much:1,mulaw:7,multipl:[1,5,7],must:[0,1,7],n:7,name:[2,6,7],need:[2,6],new_transcription_config:2,nochi:1,nokei:1,non:[1,3,7],none:[0,1,2,5,7],nonetyp:7,normal:7,note:[0,3],notif:7,notification_config:7,notificationconfig:7,number:[1,5,7],oauth2:7,object:[0,2,5],one:1,onli:[1,2,7],open:[0,6],oper:1,operating_point:7,optim:7,option:[0,1,2,7],order:4,os:0,other:[0,1],out:2,outgo:2,output:[1,5,7],output_local:7,overhead:1,overrid:1,overriden:[1,7],own:[1,7],pack:[1,2,7],packag:5,page:6,paragraph:[1,7],param:0,paramet:[0,2,5,6,7],part:[6,7],partial:[1,6,7],particular:2,pass:[0,2],path:[0,6],pathlik:0,pcm_f32le:[1,7],pcm_s16le:7,per:7,perform:1,permit:[1,7],piec:1,ping:7,ping_timeout_second:7,place:5,plaintext:1,pleas:6,point:1,pong:7,pool:0,possibl:[1,2],post:7,potenti:7,pre:1,prefer:2,preset:1,previous:[0,7],print:[1,2,6],print_partial_transcript:6,print_transcript:6,probabl:2,process:[1,2],produc:[2,7],producer_consum:2,product:1,profil:1,provid:[0,1,6],puctuat:7,punctuat:[1,7],punctuation_overrid:7,punctuation_permitted_mark:1,punctuation_sensit:1,put:7,queri:[0,7],rais:[0,2,4,5],rate:[1,7],rather:1,raw:[1,7],rb:6,re:[2,7],read:[1,2,5],read_in_chunk:5,readm:6,readthedoc:2,real:[1,2,7],realtim:[1,3,6],realtime_url:1,receipt:7,receiv:[1,2],recognisedent:1,recognit:[2,7],recognitionstart:[2,7],recurs:[5,7],redirect:1,refer:2,regist:6,regular:[1,7],remov:[1,7],repres:1,request:[0,1,7],requir:[0,1],respect:1,respond:2,respons:[0,7],rest:0,result:[0,2],retain:1,retriev:1,rfc:7,rt:[3,6,7],rt_self_service_url:3,rtconnectionset:7,rtspeakerdiarizationconfig:7,rttranslationconfig:7,run:[0,1,2,7],run_synchron:[2,6],s:[1,5,7],saa:[0,1],sampl:[1,7],sample_r:[1,2,7],sc:1,sdk:0,search:6,second:[2,7],section:7,see:[0,6],select:1,self:[1,3],semaphor:7,semaphore_timeout_second:7,send:[0,1,7],send_request:0,sensit:[1,7],sent:[2,7],sentenc:7,sentiment:[1,7],sentiment_analysis_config:7,sentimentanalysisconfig:7,separ:1,sequenc:5,server:[1,2,7],servermessagetyp:[2,6,7],servic:3,session:[2,4,7],set:[0,2,6,7],setrecognitionconfig:[2,7],setup:1,share:1,should:[1,2,7],show:1,sign:1,simpl:[1,2],singl:[1,7],size:[1,5,7],sm:0,small:1,sound:1,sourc:[0,2,4,5,7],space:[1,7],speaker:[1,7],speaker_chang:1,speaker_change_sensit:[1,7],speaker_diarization_config:7,speaker_diarization_max_speak:1,speaker_diarization_sensit:1,speaker_sensit:7,special:[1,7],specif:7,specifi:[1,7],speech:1,srt:[0,1,7],srt_overrid:7,srtoverrid:7,ssl:[1,7],ssl_context:7,sslcontext:7,standard:[1,7],start:7,startrecognit:7,statu:[0,7],stderr:1,stdout:1,still:0,stop:2,str:[0,2,5,7],stream:[1,2,5,7],streaming_mod:7,sub:6,submit:0,submit_job:0,subset:2,subtitl:7,successfulli:7,summar:[1,7],summari:1,summarization_config:7,summarizationconfig:7,summary_length:7,summary_typ:7,suppli:7,support:7,symbol:1,synchron:2,t:[2,3,6],target:7,target_languag:7,task:2,temp:1,temporari:[1,7],termin:0,text:7,than:[0,1],thei:[2,7],thi:[0,1,2,5,6,7],threshold:7,time:[1,2,7],timeout:[2,7],timeouterror:2,token:[1,6,7],toml:1,too:1,tool:6,topic:[1,7],topic_detection_config:7,topicdetectionconfig:7,transcrib:6,transcript:[0,1,2,4,6,7],transcription_config:[0,2],transcription_format:0,transcriptionconfig:[2,6,7],transcriptionerror:[0,4],translat:[1,7],translation_config:7,translation_target_languag:1,translationconfig:7,tupl:0,turn:5,txt:[0,1],type:[0,1,2,5,7],unbreak:1,union:[0,2,7],unnecessari:1,unset:0,until:[0,2,7],up:0,updat:[1,2],update_transcription_config:2,url:[0,1,2,3,6,7],us:[0,1,2,3,4,5,7],usag:1,usagemod:7,user:[1,2,4],util:5,v2:[0,1,2,3,6],v:1,valid:[0,1,2],valu:[0,1,5,7],valueerror:[2,5],variou:7,verbos:1,version:5,via:2,vocab:1,vocab_filepath:1,vocabulari:7,vv:1,wa:[1,4,5],wai:2,wait:1,wait_for_complet:0,warn:7,wav:6,waveform:6,we:[0,2,7],websocket:[1,2,7],websocketcli:[2,6],when:[0,1,2,7],where:[1,5,7],wherev:1,whether:[1,2,7],which:[0,1,2,5,7],white:7,wire:1,within:[0,1,7],word:7,work:1,would:7,wrap:7,wrapper:[0,2,6],ws:6,wss:[1,2,3,6],yet:2,yield:5,you:[0,1,2],your:[1,7]},titles:["speechmatics.batch_client","Speechmatics CLI Tool","speechmatics.client","speechmatics.client","speechmatics.exceptions","speechmatics.helpers","speechmatics-python","speechmatics.models"],titleterms:{argument:1,batch:1,batch_client:0,cli:1,client:[2,3],command:[1,6],config:1,delet:1,exampl:6,except:4,get:1,helper:5,indic:6,job:1,librari:6,line:6,list:1,mode:1,model:7,name:1,posit:1,python:6,refer:6,result:1,rt:1,set:1,speechmat:[0,1,2,3,4,5,6,7],statu:1,sub:1,submit:1,tabl:6,tool:1,transcrib:1,unset:1,usag:6}})
\ No newline at end of file
diff --git a/speechmatics/cli.py b/speechmatics/cli.py
index bae9006..2127a3c 100755
--- a/speechmatics/cli.py
+++ b/speechmatics/cli.py
@@ -37,6 +37,7 @@
ServerMessageType,
SentimentAnalysisConfig,
SummarizationConfig,
+ TopicDetectionConfig,
TranscriptionConfig,
)
@@ -325,6 +326,15 @@ def get_transcription_config(
if args_sentiment_analysis or sentiment_analysis_config:
config["sentiment_analysis_config"] = SentimentAnalysisConfig()
+ topic_detection_config = config.get("topic_detection_config", {})
+ args_topic_detection = args.get("detect_topics")
+ if args_topic_detection or topic_detection_config:
+ topic_detection_config = TopicDetectionConfig()
+ topics = args.get("topics", topic_detection_config.get("topics"))
+ if topics:
+ topic_detection_config.topics = topics
+ config["topic_detection_config"] = topic_detection_config
+
if args["mode"] == "rt":
# pylint: disable=unexpected-keyword-arg
return TranscriptionConfig(**config)
diff --git a/speechmatics/cli_parser.py b/speechmatics/cli_parser.py
index b0a36fd..02adcc8 100644
--- a/speechmatics/cli_parser.py
+++ b/speechmatics/cli_parser.py
@@ -283,6 +283,24 @@ def get_arg_parser():
help="Perform sentiment analysis on the transcript",
)
+ # Parent parser for batch topic-detection argument
+ batch_topic_detection_parser = argparse.ArgumentParser(add_help=False)
+ batch_topic_detection_parser.add_argument(
+ "--detect-topics",
+ dest="detect_topics",
+ action="store_true",
+ default=False,
+ help="Whether to detect topics in transcript",
+ )
+ batch_topic_detection_parser.add_argument(
+ "--topics",
+ dest="topics",
+ default=None,
+ type=str,
+ required=False,
+ help="Comma-separated list of topics for topic detection",
+ )
+
# Parent parser for output type
output_format_parser = argparse.ArgumentParser(add_help=False)
output_format_parser.add_argument(
@@ -472,6 +490,7 @@ def get_arg_parser():
batch_diarization_parser,
batch_summarization_parser,
batch_sentiment_analysis_parser,
+ batch_topic_detection_parser,
],
help="Transcribe one or more audio files using batch mode, while waiting for results.",
)
@@ -486,6 +505,7 @@ def get_arg_parser():
batch_diarization_parser,
batch_summarization_parser,
batch_sentiment_analysis_parser,
+ batch_topic_detection_parser,
],
help="Submit one or more files for transcription.",
)
diff --git a/speechmatics/models.py b/speechmatics/models.py
index 996980f..4dda620 100644
--- a/speechmatics/models.py
+++ b/speechmatics/models.py
@@ -199,6 +199,14 @@ class SentimentAnalysisConfig:
"""Sentiment Analysis config."""
+@dataclass
+class TopicDetectionConfig:
+ """Defines topic detection parameters."""
+
+ topics: List[str] = None
+ """Optional list of topics for topic detection."""
+
+
@dataclass(init=False)
class TranscriptionConfig(_TranscriptionConfig):
# pylint: disable=too-many-instance-attributes
@@ -291,6 +299,9 @@ class BatchTranscriptionConfig(_TranscriptionConfig):
sentiment_analysis_config: Optional[SentimentAnalysisConfig] = None
"""Optional configuration for sentiment analysis of the transcript"""
+ topic_detection_config: Optional[TopicDetectionConfig] = None
+ """Optional configuration for detecting topics of the transcript"""
+
def as_config(self):
dictionary = self.asdict()
@@ -303,6 +314,7 @@ def as_config(self):
srt_overrides = dictionary.pop("srt_overrides", None)
summarization_config = dictionary.pop("summarization_config", None)
sentiment_analysis_config = dictionary.pop("sentiment_analysis_config", None)
+ topic_detection_config = dictionary.pop("topic_detection_config", None)
config = {"type": "transcription", "transcription_config": dictionary}
if fetch_data:
@@ -328,6 +340,9 @@ def as_config(self):
if sentiment_analysis_config is not None:
config["sentiment_analysis_config"] = sentiment_analysis_config
+ if topic_detection_config:
+ config["topic_detection_config"] = topic_detection_config
+
return json.dumps(config)
diff --git a/tests/data/transcription_config.json b/tests/data/transcription_config.json
index d282be7..ce32188 100644
--- a/tests/data/transcription_config.json
+++ b/tests/data/transcription_config.json
@@ -11,5 +11,6 @@
"summary_length": "brief",
"summary_type": "bullets"
},
- "sentiment_analysis_config": {}
+ "sentiment_analysis_config": {},
+ "topic_detection_config": {}
}
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 8a704dc..a9a6c32 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -300,6 +300,24 @@
"sentiment_analysis": True,
},
),
+ (
+ ["batch", "transcribe", "--detect-topics"],
+ {
+ "detect_topics": True,
+ },
+ ),
+ (
+ [
+ "batch",
+ "transcribe",
+ "--detect-topics",
+ "--topics=topic1,topic2,topic3",
+ ],
+ {
+ "detect_topics": True,
+ "topics": "topic1,topic2,topic3",
+ },
+ ),
],
)
def test_cli_arg_parse_with_file(args, values):
diff --git a/tests/test_models.py b/tests/test_models.py
index 759de2c..5821763 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -149,6 +149,26 @@ def test_summarization_config(params, want):
assert asdict(summarization_config) == want
+@mark.parametrize(
+ "params, want",
+ [
+ param(
+ {},
+ {"topics": None},
+ id="default params",
+ ),
+ param(
+ {"topics": ["topic1", "topic2"]},
+ {"topics": ["topic1", "topic2"]},
+ id="set topics param",
+ ),
+ ],
+)
+def test_topic_detection_config(params, want):
+ topic_detection_config = models.TopicDetectionConfig(**params)
+ assert asdict(topic_detection_config) == want
+
+
@mark.parametrize(
"params, want",
[