Skip to content

Commit

Permalink
Audio Events batch CLI parser
Browse files Browse the repository at this point in the history
  • Loading branch information
HennerM committed Mar 20, 2024
1 parent 1ad89e5 commit 9b8d5a5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.14.5] - 2024-03-20

## Added

- Support for audio_events in Batch CLI.
- Support `types` whitelist for audio events.

## [1.14.4] - 2024-03-04

## Added
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.14.4
1.14.5
2 changes: 2 additions & 0 deletions speechmatics/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ def get_transcription_config(
types = None
if audio_events_config and audio_events_config.get("types"):
types = audio_events_config.get("types")
if args.get("event_types"):
types = str(args.get("event_types")).split(",")
config["audio_events_config"] = AudioEventsConfig(types)

if args["mode"] == "rt":
Expand Down
24 changes: 24 additions & 0 deletions speechmatics/cli_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,29 @@ def get_arg_parser():
action="store_true",
help="Enable audio event detection and print events in square-brackets to the console, e.g. [MUSIC]",
)
rt_transcribe_command_parser.add_argument(
"--event-types",
default=None,
type=str,
required=False,
help="Comma-separated list of whitelisted event types for audio events.",
)

# Parent parser for batch auto-chapters argument
batch_audio_events_parser = argparse.ArgumentParser(add_help=False)
batch_audio_events_parser.add_argument(
"--audio-events",
action="store_true",
help="Enable audio event detection, "
"will include `audio_events` and `audio_event_summary` keys in output (JSON only)",
)
batch_audio_events_parser.add_argument(
"--event-types",
default=None,
type=str,
required=False,
help="Comma-separated list of whitelisted event types for audio events.",
)

# Build our actual parsers.
mode_subparsers = parser.add_subparsers(title="Mode", dest="mode")
Expand Down Expand Up @@ -514,6 +537,7 @@ def get_arg_parser():
batch_sentiment_analysis_parser,
batch_topic_detection_parser,
batch_auto_chapters_parser,
batch_audio_events_parser,
],
help="Transcribe one or more audio files using batch mode, while waiting for results.",
)
Expand Down

0 comments on commit 9b8d5a5

Please sign in to comment.