Skip to content

Commit

Permalink
#85 support smart formatting version
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew R Freed <[email protected]>
  • Loading branch information
andrewrfreed committed Dec 10, 2024
1 parent 00013b5 commit 6af05f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def __init__(self, audio_file_name:str, transcriptions:Transcriptions):
RecognizeCallback.__init__(self)
self.audio_file_name = audio_file_name
self.transcriptions = transcriptions
logging.debug("initialized object")

def on_data(self, data):
#print(json.dumps(data, indent=2))
Expand All @@ -59,6 +60,7 @@ def on_data(self, data):

def on_error(self, error):
logging.error(f'{self.audio_file_name} - Recognize Error received: {error}')
logging.exception(f"Error transcribing {self.audio_file_name}:",exc_info=error)

def on_inactivity_timeout(self, error):
logging.error(f'{self.audio_file_name} - Inactivity timeout: {error}')
Expand Down Expand Up @@ -117,6 +119,7 @@ def transcribe(self, filename):
speech_detector_sensitivity = float(self.config.getValue("SpeechToText", "speech_detector_sensitivity"))
background_audio_suppression = float(self.config.getValue("SpeechToText", "background_audio_suppression"))
character_insertion_bias = float(self.config.getValue("SpeechToText", "character_insertion_bias", 0.0))
smart_formatting_version = int(self.config.getValue ("SpeechToText", "smart_formatting_version", 0))
if language_customization_id is not None:
customization_weight = float(self.config.getValue("SpeechToText", "customization_weight"))
else:
Expand Down Expand Up @@ -154,6 +157,7 @@ def transcribe(self, filename):
speech_detector_sensitivity=speech_detector_sensitivity,
background_audio_suppression=background_audio_suppression,
smart_formatting=smart_formatting,
smart_formatting_version=smart_formatting_version,
low_latency=low_latency,
skip_zero_len_words=skip_zero_len_words,
character_insertion_bias=character_insertion_bias,
Expand Down

0 comments on commit 6af05f8

Please sign in to comment.