diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..446ef9b --- /dev/null +++ b/__init__.py @@ -0,0 +1,61 @@ +# Copyright 2016 Mycroft AI, Inc. +# +# This file is part of Mycroft Core. +# +# Mycroft Core is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Mycroft Core is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Mycroft Core. If not, see . + +from adapt.intent import IntentBuilder + +from mycroft.skills.core import MycroftSkill +from mycroft.util.log import getLogger + +__author__ = 'eward' + +LOGGER = getLogger(__name__) + + +class HelloWorldSkill(MycroftSkill): + def __init__(self): + super(HelloWorldSkill, self).__init__(name="HelloWorldSkill") + + def initialize(self): + thank_you_intent = IntentBuilder("ThankYouIntent"). \ + require("ThankYouKeyword").build() + self.register_intent(thank_you_intent, self.handle_thank_you_intent) + + how_are_you_intent = IntentBuilder("HowAreYouIntent"). \ + require("HowAreYouKeyword").build() + self.register_intent(how_are_you_intent, + self.handle_how_are_you_intent) + + hello_world_intent = IntentBuilder("HelloWorldIntent"). \ + require("HelloWorldKeyword").build() + self.register_intent(hello_world_intent, + self.handle_hello_world_intent) + + def handle_thank_you_intent(self, message): + self.speak_dialog("welcome") + + def handle_how_are_you_intent(self, message): + self.speak_dialog("how.are.you") + + def handle_hello_world_intent(self, message): + self.speak_dialog("hello.world") + + def stop(self): + pass + + +def create_skill(): + return HelloWorldSkill() diff --git a/dialog/en-us/hello.world.dialog b/dialog/en-us/hello.world.dialog new file mode 100644 index 0000000..811f098 --- /dev/null +++ b/dialog/en-us/hello.world.dialog @@ -0,0 +1,3 @@ +Hello world +Hello +Hi to you too diff --git a/dialog/en-us/how.are.you.dialog b/dialog/en-us/how.are.you.dialog new file mode 100644 index 0000000..af69447 --- /dev/null +++ b/dialog/en-us/how.are.you.dialog @@ -0,0 +1,6 @@ +I'm doing well +Pretty well +Not bad +I'm doing excellent +Could be better +I'm doing very well diff --git a/dialog/en-us/welcome.dialog b/dialog/en-us/welcome.dialog new file mode 100644 index 0000000..2f6491e --- /dev/null +++ b/dialog/en-us/welcome.dialog @@ -0,0 +1,6 @@ +Any time. +Glad to be of service. +Glad to help. +My Pleasure. +No problem. +You're welcome. diff --git a/test/intent/sample1.intent.json b/test/intent/sample1.intent.json new file mode 100644 index 0000000..4b4b94b --- /dev/null +++ b/test/intent/sample1.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "Thank you", + "intent_type": "ThankYouIntent", + "intent": { + "ThankYouKeyword": "thank you" + } +} diff --git a/test/intent/sample2.intent.json b/test/intent/sample2.intent.json new file mode 100644 index 0000000..78ac193 --- /dev/null +++ b/test/intent/sample2.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "Thanks", + "intent_type": "ThankYouIntent", + "intent": { + "ThankYouKeyword": "thanks" + } +} diff --git a/test/intent/sample3.intent.json b/test/intent/sample3.intent.json new file mode 100644 index 0000000..71f8295 --- /dev/null +++ b/test/intent/sample3.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "Hello world", + "intent_type": "HelloWorldIntent", + "intent": { + "HelloWorldKeyword": "hello world" + } +} diff --git a/test/intent/sample4.intent.json b/test/intent/sample4.intent.json new file mode 100644 index 0000000..938cd6b --- /dev/null +++ b/test/intent/sample4.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "Greetings", + "intent_type": "HelloWorldIntent", + "intent": { + "HelloWorldKeyword": "greetings" + } +} diff --git a/test/intent/sample5.intent.json b/test/intent/sample5.intent.json new file mode 100644 index 0000000..65d54c1 --- /dev/null +++ b/test/intent/sample5.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "How are you doing", + "intent_type": "HowAreYouIntent", + "intent": { + "HowAreYouKeyword": "how are you" + } +} diff --git a/test/intent/sample6.intent.json b/test/intent/sample6.intent.json new file mode 100644 index 0000000..9eab66c --- /dev/null +++ b/test/intent/sample6.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "How has your day been", + "intent_type": "HowAreYouIntent", + "intent": { + "HowAreYouKeyword": "how has your day been" + } +} diff --git a/vocab/en-us/HelloWorldKeyword.voc b/vocab/en-us/HelloWorldKeyword.voc new file mode 100644 index 0000000..5ffa264 --- /dev/null +++ b/vocab/en-us/HelloWorldKeyword.voc @@ -0,0 +1,2 @@ +hello world +greetings diff --git a/vocab/en-us/HowAreYouKeyword.voc b/vocab/en-us/HowAreYouKeyword.voc new file mode 100644 index 0000000..143a400 --- /dev/null +++ b/vocab/en-us/HowAreYouKeyword.voc @@ -0,0 +1,3 @@ +how are you +how have you been +how has your day been diff --git a/vocab/en-us/ThankYouKeyword.voc b/vocab/en-us/ThankYouKeyword.voc new file mode 100644 index 0000000..d280f1b --- /dev/null +++ b/vocab/en-us/ThankYouKeyword.voc @@ -0,0 +1,2 @@ +thank you +thanks