rhasspy / wyoming-vosk

Wyoming protocol server for the vosk speech to text system
MIT License
10 stars 5 forks source link

Error in importing custom sentences #9

Open marcopi opened 1 month ago

marcopi commented 1 month ago

Hi, I tried latest version of wyoming-vosk module but I found a problem in importing sentences from it.yaml (I'm italian).

I found a little bug, probably due to a versione mismatch in hassil library. This is the patch to apply to let vosk read correctly my sentences.

commit a910c6f9039c99db4c14385deed8eb2c012cd195 (HEAD -> master)
Author: Marco Piazza <mpiazza@gmail.com>
Date:   Sun Sep 22 14:28:53 2024 +0200

    Use correct constructor for TextSlotList

diff --git a/wyoming_vosk/sentences.py b/wyoming_vosk/sentences.py
index 2afc8fb..ca63eb6 100644
--- a/wyoming_vosk/sentences.py
+++ b/wyoming_vosk/sentences.py
@@ -170,8 +170,7 @@ def generate_sentences(sentences_yaml: Dict[str, Any], db_conn: sqlite3.Connecti
                 slot_list_values.append(
                     TextSlotValue(TextChunk(value_in), value_out=value_out)
                 )
-
-        slot_lists[slot_name] = TextSlotList(slot_list_values)
+        slot_lists[slot_name] = TextSlotList(name=slot_name,values=slot_list_values)

     # Load expansion rules
     expansion_rules: Dict[str, hassil.Sentence] = {}

These are my modules versions:

(.venv) pi@rpi-64casa:/opt/wyoming-vosk $ pip list
Package            Version
------------------ ---------
certifi            2024.8.30
cffi               1.17.0
charset-normalizer 3.3.2
hassil             1.7.4
idna               3.8
pip                24.2
pycparser          2.22
PyYAML             6.0.2
requests           2.32.3
setuptools         74.1.0
srt                3.5.3
tqdm               4.66.5
unicode_rbnf       1.2.0
urllib3            2.2.2
vosk               0.3.45
websockets         13.0.1
wheel              0.44.0
wyoming            1.5.2

Anyway thanks for this great tool.