MycroftAI / skill-joke

Mycroft AI official Joke Skill - provide basic jokes
https://mycroft.ai/skills
Apache License 2.0
7 stars 20 forks source link

Language problem #21

Open luismanson opened 4 years ago

luismanson commented 4 years ago

Hello, i got this exeption. Im using the Pi edition of Mycroft and stting up spanish language. I told 'tell me a joke' in my language.


Traceback (most recent call last):
  File "/home/pi/mycroft-core/mycroft/skills/mycroft_skill/event_container.py", line 66, in wrapper
    handler(message)
  File "/opt/mycroft/skills/mycroft-joke.mycroftai/__init__.py", line 37, in handle_general_joke
    self.speak_joke(self.lang[:-3], selected)
  File "/opt/mycroft/skills/mycroft-joke.mycroftai/__init__.py", line 32, in speak_joke
    self.speak(pyjokes.get_joke(language=lang, category=category))
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyjokes/pyjokes.py", line 63, in get_joke
    jokes = get_jokes(language, category)
  File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyjokes/pyjokes.py", line 44, in get_jokes
    raise CategoryNotFoundError('No such category %s in language %s' % (category, language))
pyjokes.pyjokes.CategoryNotFoundError: No such category chuck in language es
krisgesling commented 4 years ago

Hi Luis, thanks for flagging this.

What's the exact phrase you used for "tell me a joke"? Just wondering why it went searching for a Chuck Norris joke in particular.

If jokes are unavailable in a language we should be handling that exception and either saying so, or taking the english version and attempting an automated translation.

luismanson commented 4 years ago

What's the exact phrase you used for "tell me a joke"?

voice.log:2020-06-15 01:51:46.343 | INFO | 532 | __main__:handle_utterance:72 | Utterance: ['contame un chiste'] It's literally Spanish for 'tell me a joke'. No more, no less. (trying to be precise, not rude.)

Now that you say that... I did not notice the 'chuck' word in the log. Just tried that same phrase now and worked perfect. It's weird because that's the only logged mention and as you can see, it's not in the utterance log...

Thanks for your help!

luismanson commented 4 years ago

Nevermind... pyjokes.pyjokes.CategoryNotFoundError: No such category chuck in language es ^--- NEWEST ---^

Same phrase, 'tell me a joke'

forslund commented 4 years ago

The skill randomized a category for that query so some sort of handling needs to be added if the language doesn't support all categories