New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add intent fallback system #938

Merged
merged 5 commits into from Aug 8, 2017

Conversation

Projects
None yet
3 participants
@MatthewScholefield
Copy link
Member

MatthewScholefield commented Aug 1, 2017

This is the same pull request from 3 weeks ago, but with skill-wolfram-alpha blacklisted and a new fallback-wolfram-alpha added to the default skills. Note: since Wolfram's API key is currently not working, we this cannot be tested.

Original description:
This is a new system that allows other skills to register as fallbacks to handle general knowledge queries. For now, each skill self-assigns a priority where 0 is the highest and 100 is very low priority. When an intent failure occurs, each fallback gets run until one returns True meaning it found a response to speak to the user. Example usage:

skill-my-fallback/__init__.py:

from mycroft.skills.core import MycroftSkill
class MyFallbackSkilll(MycroftSkill):
    def __init__(self):
        MycroftSkill.__init__(self, name="MyFallbackSkill")

    def initialize(self):
        self.register_fallback(self.handle_fallback, 80)

    def handle_fallback(self, message):
        if 'what is' in message.data['utterance']:
            self.speak_dialog('the answer is always 42')
            return True
        return False

This PR also removes the multi utterance intent fail. It only makes sense to emit an intent_failure regardless of the amount of intents, especially since we only ever receive one utterance anymore.

When testing, check functionality of Wolfram Alpha for questions like what is a fox (and maybe wolfram skill reloading when /opt/mycroft/skill-wolfram-alpha/init.py is edited).

@MatthewScholefield MatthewScholefield requested a review from forslund Aug 1, 2017

@coveralls

This comment has been minimized.

Copy link

coveralls commented Aug 1, 2017

Coverage Status

Coverage decreased (-0.05%) to 41.339% when pulling 4db6539 on feature/fallbacks into e1a1751 on dev.

@forslund

This comment has been minimized.

Copy link
Member

forslund commented Aug 2, 2017

Looks extremely good. Unfortunately wolfram alpha seems to be unavailable to me right now so I haven't been able to test it.

Also PR 145 on mycroft-skills (MycroftAI/mycroft-skills#145) need to be merged before this one.

Would like to verify it with a working wolfram alpha before merging.

MatthewScholefield added some commits Jun 16, 2017

Add intent fallback system
Also removes multi utterence intent fail. Only makes sense to emit an intent_failure regardless of the amount of intents
Convert static methods in FallbackSkill to class methods
This makes it more concise and mimics the behavior of self, but for static methods
Change skill-wolfram-alpha to fallback-wolfram-alpha
This is necessary because of the API breaking change

@MatthewScholefield MatthewScholefield force-pushed the feature/fallbacks branch from 4db6539 to fee8ffa Aug 3, 2017

@coveralls

This comment has been minimized.

Copy link

coveralls commented Aug 3, 2017

Coverage Status

Coverage decreased (-0.04%) to 41.221% when pulling fee8ffa on feature/fallbacks into 4c1fbcb on dev.

@forslund forslund merged commit ab22106 into dev Aug 8, 2017

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.1%) to 41.221%
Details

@MatthewScholefield MatthewScholefield deleted the feature/fallbacks branch Sep 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment