wyoming-microsoft-stt 1.3.3__py3-none-any.whl → 1.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
tests/test_transcribe.py CHANGED
@@ -99,7 +99,7 @@ async def test_transcribe() -> None:
99
99
  text = re.sub(r"[^a-z ]", "", text)
100
100
  _LOGGER.info(f"Received transcript: {text}")
101
101
 
102
- original_text = "The Netherlands, informally Holland, is a country in Northwestern Europe with overseas territories in the Caribbean. It is the largest of the four constituent countries of the Kingdom of the Netherlands. The Netherlands consists of 12 provinces. It borders Germany to the east and Belgium to the south, with the North Sea coastline to the north and west. It shares maritime borders with the United Kingdom, Germany, and Belgium."
102
+ original_text = "The Netherlands, informally Holland, is a country in Northwestern Europe with overseas territories in the Caribbean. It is the largest of the four constituent countries of the Kingdom of the Netherlands. The Netherlands consists of 12 provinces. It borders Germany to the east and Belgium to the south, with a North Sea coastline to the north and west. It shares maritime borders with the United Kingdom, Germany, and Belgium."
103
103
  # Remove punctuation and convert to lowercase
104
104
  original_text = original_text.lower()
105
105
  original_text = re.sub(r"[^a-z ]", "", original_text)
@@ -25,6 +25,7 @@ def handle_stop_signal(*args):
25
25
  """Handle shutdown signal and set the stop event."""
26
26
  _LOGGER.info("Received stop signal. Shutting down...")
27
27
  stop_event.set()
28
+ exit()
28
29
 
29
30
 
30
31
  def parse_arguments():
@@ -17,7 +17,7 @@ class MicrosoftSTT:
17
17
 
18
18
  self._stream: speechsdk.audio.PushAudioInputStream | None = None
19
19
  self._speech_recognizer: speechsdk.SpeechRecognizer | None = None
20
- self._results: list[speechsdk.SpeechRecognitionResult] = []
20
+ self._results: speechsdk.SpeechRecognitionResult | None = None
21
21
 
22
22
  try:
23
23
  # Initialize the speech configuration with the provided subscription key and region
@@ -90,6 +90,7 @@ class MicrosoftSTT:
90
90
 
91
91
  def push_audio_chunk(self, chunk: bytes) -> None:
92
92
  """Push an audio chunk to the recognizer."""
93
+ _LOGGER.debug(f"Pushing audio chunk of size {len(chunk)} bytes...")
93
94
  self._stream.write(chunk)
94
95
 
95
96
  def stop_audio_chunk(self) -> None:
@@ -108,13 +109,17 @@ class MicrosoftSTT:
108
109
 
109
110
  self._speech_recognizer.stop_continuous_recognition()
110
111
 
112
+ if self._results is None:
113
+ _LOGGER.debug("No results from transcription.")
114
+ return ""
115
+
111
116
  return self._results.text
112
117
 
113
118
  except Exception as e:
114
119
  _LOGGER.error(f"Failed to transcribe audio: {e}")
115
120
  return ""
116
121
 
117
- def get_language(self, language: str) -> dict:
122
+ def get_language(self, language: None | str) -> dict:
118
123
  """Get the language code."""
119
124
  if len(self.args.language) > 1:
120
125
  auto_detect_source_language_config = (
@@ -1,3 +1,3 @@
1
1
  """Version information."""
2
2
 
3
- __version__ = "1.3.3"
3
+ __version__ = "1.3.5"
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wyoming-microsoft-stt
3
- Version: 1.3.3
3
+ Version: 1.3.5
4
4
  Summary: Add your description here
5
5
  Home-page: https://github.com/hugobloem/wyoming-microsoft-stt
6
6
  Author: Hugo Bloem
7
7
  Author-email:
8
8
  Requires-Python: >=3.13
9
9
  Description-Content-Type: text/markdown
10
- Requires-Dist: azure-cognitiveservices-speech>=1.45.0
10
+ Requires-Dist: azure-cognitiveservices-speech>=1.46.0
11
11
  Requires-Dist: pydantic>=2.11.7
12
12
  Requires-Dist: wyoming>=1.7.2
13
13
  Dynamic: author
@@ -2,15 +2,15 @@ tests/__init__.py,sha256=ZEU8_ARBRGIqaAOTcPRsjXxcfHSojBm-5-krYBN-68g,13
2
2
  tests/conftest.py,sha256=iSju8g6PiODcg9eY4_lZaVcubXMlfnx1CpyGVsmTAgY,340
3
3
  tests/test_microsoft_stt.py,sha256=CO6xyLHFcE1kqJ_XuGprRu0i28zTN2oHaKtomK_aJIU,594
4
4
  tests/test_multilanguage.py,sha256=wRtyWuhWBmA5Yf01JNbmgxqoVKmDcE6XHz9QcfSR700,3100
5
- tests/test_transcribe.py,sha256=BqT-KLZR6UM9RqNI43RZFz6WLkXFcjk2a2WLszhDgso,3674
5
+ tests/test_transcribe.py,sha256=qRxpUO94YQSSdlurupCec4D1KNxHrdb9jb_YkITDf-U,3672
6
6
  wyoming_microsoft_stt/__init__.py,sha256=92Kms90cxU6Zs5XjNZiYvIGLA3Yd-BizN-G8f7n506I,3365
7
- wyoming_microsoft_stt/__main__.py,sha256=gA0wM3OCLdEq7ewMRrlWs4TVpXvFlITMaX_4lP3ed7E,5577
7
+ wyoming_microsoft_stt/__main__.py,sha256=QJq8VuIdr1bz9v3kYPnUF6gQqcyh7EJYrJWeMzJ7QJE,5588
8
8
  wyoming_microsoft_stt/download.py,sha256=mTWZl9kVaE7KGeO2d0SS7wztDN6tGo9AudXWhN8uKhg,3379
9
9
  wyoming_microsoft_stt/handler.py,sha256=dWm9etFANRU33IDU-p85enHmWtMtTtW522I3AJbTAxg,3330
10
10
  wyoming_microsoft_stt/languages.json,sha256=eDZuPJLzDjdZlh0I4081OTkLPt6nZdUY8ra45c7oMCc,1881
11
- wyoming_microsoft_stt/microsoft_stt.py,sha256=2Rb9uoOxGFpQfwXux5p3jwop_3poF-75U_84q5QRmt0,5357
12
- wyoming_microsoft_stt/version.py,sha256=iG_JqR_Z5wfSTlMqH9H1vmrmlcgyFJdbRBRllY0yDgU,50
13
- wyoming_microsoft_stt-1.3.3.dist-info/METADATA,sha256=Hh7h4BDS_hLd4t3Y8LOEpAMpRzGph7TwfPEliYQA6mA,5792
14
- wyoming_microsoft_stt-1.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
- wyoming_microsoft_stt-1.3.3.dist-info/top_level.txt,sha256=aURyYXybYBAybkVTs2RFT5ctnPz5pRa_B7Gn9_SKhL8,28
16
- wyoming_microsoft_stt-1.3.3.dist-info/RECORD,,
11
+ wyoming_microsoft_stt/microsoft_stt.py,sha256=NmhA42y1WWnK4ubbHOnL3QYfB6N4labF_xkB2C3ZJPM,5572
12
+ wyoming_microsoft_stt/version.py,sha256=gts4Ey8VuhlTJIs3BIfbiqe_Ow6m1nRUoVq7-gI9q6A,50
13
+ wyoming_microsoft_stt-1.3.5.dist-info/METADATA,sha256=WH3QVMOcN_S-0ZRFmLLRq2FqtaRvVxJU-Giao5pdGQ0,5792
14
+ wyoming_microsoft_stt-1.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
15
+ wyoming_microsoft_stt-1.3.5.dist-info/top_level.txt,sha256=aURyYXybYBAybkVTs2RFT5ctnPz5pRa_B7Gn9_SKhL8,28
16
+ wyoming_microsoft_stt-1.3.5.dist-info/RECORD,,