synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
950 stars 101 forks source link

unknown_words.txt saving/parsing issue #210

Open litinoveweedle opened 4 years ago

litinoveweedle commented 4 years ago

Using Rhasspy on RPi with following configuration:

{ "handle": { "system": "hass" }, "home_assistant": { "access_token": "SECRET", "url": "https://XXXXXXXXXX:8123" }, "intent": { "system": "conversation" }, "microphone": { "arecord": { "device": "plughw:CARD=ArrayUAC10,DEV=0" }, "system": "arecord" }, "speech_to_text": { "remote": { "url": "http://XXXXXXXXXX:12101/api/speech-to-text" }, "system": "remote" }, "text_to_speech": { "system": "flite" }, "wake": { "porcupine": { "keyword_path": "porcupine/picovoice_raspberry-pi.ppn" }, "system": "porcupine" } }

File unknown_words.txt is being written by Rhasspy (as I didn't touch the file manually) into profile directory in the following format:

cat unknown_words.txt bedroom blue closed cold door garage .....

When loading Rhasspy web console I get error:

not enough values to unpack (expected 2, got 1)

It seems, that code parsing file unknown_words.txt expects couples format, not single word on line. Would it be please possible to add correct handling for such state?

Log with full trace:

[INFO:45757756] quart.serving: 192.168.1.99:45094 GET /api/problems 1.1 200 300 204492 [INFO:45757751] quart.serving: 192.168.1.99:45104 GET /api/speakers 1.1 200 1232 354031 [DEBUG:45757743] InboxActor: -> stopped [DEBUG:45757735] InboxActor: -> stopped [INFO:45757642] quart.serving: 192.168.1.99:45102 GET /api/microphones 1.1 200 1232 245067 [DEBUG:45757624] InboxActor: -> stopped [INFO:45757565] quart.serving: 192.168.1.99:45100 GET /api/unknown-words 1.1 500 47 31015 [ERROR:45757544] main: not enough values to unpack (expected 2, got 1) Traceback (most recent call last): File "/usr/share/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1471, in full_dispatch_request result = await self.dispatch_request(request_context) File "/usr/share/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1519, in dispatchrequest return await handler(**request.view_args) File "app.py", line 871, in api_unknown_words word, pronunciation = re.split(r"[ ]+", line, maxsplit=1) ValueError: not enough values to unpack (expected 2, got 1) [INFO:45757535] quart.serving: 192.168.1.99:45106 GET /api/profile 1.1 200 9106 56415 [INFO:45757532] quart.serving: 192.168.1.99:45094 GET /api/profile 1.1 200 7013 54535 [INFO:45757524] quart.serving: 192.168.1.99:45092 GET /api/profiles 1.1 200 144 125124 [INFO:45757519] quart.serving: 192.168.1.99:45108 GET /api/events/wake 1.1 101 - 39027 [INFO:45757501] quart.serving: 192.168.1.99:45100 GET /api/phonemes 1.1 200 1526 104755 [DEBUG:45757404] main: Loading phoneme examples from /usr/share/rhasspy/profiles/en/phoneme_examples.txt [INFO:45757391] quart.serving: 192.168.1.99:45094 GET /api/slots 1.1 200 2 50046 [INFO:45757379] quart.serving: 192.168.1.99:45092 GET /api/sentences 1.1 200 581 63423 [INFO:45757310] quart.serving: 192.168.1.99:45098 GET /api/events/intent 1.1 101 - 5013 [INFO:45757235] quart.serving: 192.168.1.99:45096 GET /api/events/log 1.1 101 - 5719