@@ -42,6 +42,7 @@ class STTOptions:
4242 str
4343 ] # see https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=stt
4444 speech_endpoint : str | None = None
45+ profanity : speechsdk .enums .ProfanityOption | None = None
4546
4647
4748class STT (stt .STT ):
@@ -61,6 +62,7 @@ def __init__(
6162 languages : list [str ] = ["en-US" ],
6263 # for compatibility with other STT plugins
6364 language : str | None = None ,
65+ profanity : speechsdk .enums .ProfanityOption | None = None ,
6466 ):
6567 """
6668 Create a new instance of Azure STT.
@@ -102,6 +104,7 @@ def __init__(
102104 segmentation_silence_timeout_ms = segmentation_silence_timeout_ms ,
103105 segmentation_max_time_ms = segmentation_max_time_ms ,
104106 segmentation_strategy = segmentation_strategy ,
107+ profanity = profanity ,
105108 )
106109 self ._streams = weakref .WeakSet [SpeechStream ]()
107110
@@ -330,6 +333,8 @@ def _create_speech_recognizer(
330333 speechsdk .enums .PropertyId .Speech_SegmentationStrategy ,
331334 str (config .segmentation_strategy ),
332335 )
336+ if config .profanity is not None :
337+ speech_config .set_profanity (config .profanity )
333338
334339 auto_detect_source_language_config = None
335340 if config .languages and len (config .languages ) >= 1 :
0 commit comments