commit
b84756e970
|
@ -26,23 +26,40 @@ __author__ = 'eward'
|
|||
LOGGER = getLogger(__name__)
|
||||
|
||||
|
||||
class WelcomeSkill(MycroftSkill):
|
||||
class HelloWorldSkill(MycroftSkill):
|
||||
|
||||
def __init__(self):
|
||||
super(WelcomeSkill, self).__init__(name="WelcomeSkill")
|
||||
super(HelloWorldSkill, self).__init__(name="HelloWorldSkill")
|
||||
|
||||
def initialize(self):
|
||||
self.load_data_files(dirname(__file__))
|
||||
|
||||
welcome_intent = IntentBuilder("WelcIntent").require("WelcKey").build()
|
||||
self.register_intent(welcome_intent, self.handle_welcome_intent)
|
||||
thank_you_intent = IntentBuilder("ThankYouIntent").\
|
||||
require("ThankYouKeyword").build()
|
||||
self.register_intent(thank_you_intent, self.handle_thank_you_intent)
|
||||
|
||||
def handle_welcome_intent(self, message):
|
||||
self.speak_dialog("Welcome")
|
||||
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 WelcomeSkill()
|
||||
return HelloWorldSkill()
|
|
@ -0,0 +1,3 @@
|
|||
Hello world
|
||||
Hello
|
||||
Hi to you too
|
|
@ -0,0 +1,6 @@
|
|||
I'm doing well
|
||||
Pretty well
|
||||
Not bad
|
||||
I'm doing excellent
|
||||
Could be better
|
||||
I'm doing very well
|
|
@ -3,4 +3,4 @@ Glad to be of service.
|
|||
Glad to help.
|
||||
My Pleasure.
|
||||
No problem.
|
||||
You're welcome.
|
||||
You're welcome.
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"utterance": "Thank you",
|
||||
"intent_type": "ThankYouIntent",
|
||||
"intent": {
|
||||
"ThankYouKeyword": "thank you"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"utterance": "Thanks",
|
||||
"intent_type": "ThankYouIntent",
|
||||
"intent": {
|
||||
"ThankYouKeyword": "thanks"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"utterance": "Hello world",
|
||||
"intent_type": "HelloWorldIntent",
|
||||
"intent": {
|
||||
"HelloWorldKeyword": "hello world"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"utterance": "Greetings",
|
||||
"intent_type": "HelloWorldIntent",
|
||||
"intent": {
|
||||
"HelloWorldKeyword": "greetings"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"utterance": "How are you doing",
|
||||
"intent_type": "HowAreYouIntent",
|
||||
"intent": {
|
||||
"HowAreYouKeyword": "how are you"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"utterance": "How has your day been",
|
||||
"intent_type": "HowAreYouIntent",
|
||||
"intent": {
|
||||
"HowAreYouKeyword": "how has your day been"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
hello world
|
||||
greetings
|
|
@ -0,0 +1,3 @@
|
|||
how are you
|
||||
how have you been
|
||||
how has your day been
|
Loading…
Reference in New Issue