Skip to content

Commit 9c370ce

Browse files
authored
Add remove-disfluencies arg (#96)
* Add remove-disfluencies arg * Fix all_options test * Add remove-disfluency arg parsing * lint * Nest remove_disfluencies within a transcript_filtering_config * lint * Fix dicts to use optional type * Undo unecessary formatting change * Remove unecessary remove_disfluencies param * Fix copy paste error for transcript_filtering_config
1 parent 4b8ff20 commit 9c370ce

6 files changed

Lines changed: 30 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.14.6] - 2024-04-26
9+
10+
## Added
11+
12+
- Support for removing words tagged as disfluency.
13+
814
## [1.14.5] - 2024-03-20
915

1016
## Added

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.14.5
1+
1.14.6

speechmatics/cli.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ def get_transcription_config(
235235
"volume_threshold": args.get("volume_threshold")
236236
}
237237

238+
if args.get("remove_disfluencies") is not None:
239+
config["transcript_filtering_config"] = {}
240+
config["transcript_filtering_config"]["remove_disfluencies"] = args.get(
241+
"remove_disfluencies"
242+
)
243+
238244
if args.get("ctrl"):
239245
LOGGER.warning(f"Using internal dev control command: {args['ctrl']}")
240246
config["ctrl"] = json.loads(args["ctrl"])

speechmatics/cli_parser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,12 @@ def get_arg_parser():
486486
required=False,
487487
help="Comma-separated list of whitelisted event types for audio events.",
488488
)
489+
rt_transcribe_command_parser.add_argument(
490+
"--remove-disfluencies",
491+
default=False,
492+
action="store_true",
493+
help="Removes words tagged as disfluency.",
494+
)
489495

490496
# Parent parser for batch auto-chapters argument
491497
batch_audio_events_parser = argparse.ArgumentParser(add_help=False)

speechmatics/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,12 @@ def asdict(self) -> Dict[Any, Any]:
128128
enable_entities: bool = None
129129
"""Indicates if inverse text normalization entity output is enabled."""
130130

131-
audio_filtering_config: dict = None
131+
audio_filtering_config: Optional[dict] = None
132132
"""Configuration for limiting the transcription of quiet audio."""
133133

134+
transcript_filtering_config: Optional[dict] = None
135+
"""Configuration for applying filtering to the transcription."""
136+
134137

135138
@dataclass
136139
class RTSpeakerDiarizationConfig:

tests/test_cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ def test_rt_main_with_all_options(mock_server, tmp_path):
623623
str(chunk_size),
624624
"--auth-token=xyz",
625625
audio_path,
626+
"--remove-disfluencies",
626627
]
627628

628629
cli.main(vars(cli.parse_args(args)))
@@ -660,6 +661,12 @@ def test_rt_main_with_all_options(mock_server, tmp_path):
660661
assert msg["transcription_config"]["max_delay_mode"] == "fixed"
661662
assert msg["transcription_config"]["speaker_change_sensitivity"] == 0.8
662663
assert msg["transcription_config"].get("operating_point") is None
664+
assert (
665+
msg["transcription_config"]["transcript_filtering_config"][
666+
"remove_disfluencies"
667+
]
668+
is True
669+
)
663670

664671
# Check that the chunk size argument is respected
665672
add_audio_messages = mock_server.find_add_audio_messages()

0 commit comments

Comments
 (0)