From d9905a2d07dbc7ff5a7d1e3ec1f69e7b7b6f029a Mon Sep 17 00:00:00 2001 From: Matthew Scholefield Date: Tue, 21 Jun 2016 11:54:41 -0500 Subject: [PATCH 1/9] Removed unnecessary variable in ResponsiveRecognizer This was left over from when I was testing with making the class be asynchronous --- mycroft/client/speech/mic.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/mycroft/client/speech/mic.py b/mycroft/client/speech/mic.py index cb98af8c2c..81ea262910 100644 --- a/mycroft/client/speech/mic.py +++ b/mycroft/client/speech/mic.py @@ -137,8 +137,6 @@ class ResponsiveRecognizer(speech_recognition.Recognizer): def __init__(self, wake_word_recognizer): speech_recognition.Recognizer.__init__(self) - self.daemon = True - self.wake_word_recognizer = wake_word_recognizer self.audio = pyaudio.PyAudio() From e759c8ab33a9b9c5663eca790cf7f8a01918c206 Mon Sep 17 00:00:00 2001 From: Matthew Scholefield Date: Tue, 21 Jun 2016 12:15:58 -0500 Subject: [PATCH 2/9] Added back some SessionManager lines to replicate old behavior more precisely I'm not quiet sure where the session_id was ever used when emitted in the payload however just to be safe I kept it in there. This is to be sure there are no differences between the old and new listener that could be causing Cerberus problems. --- mycroft/client/speech/listener.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mycroft/client/speech/listener.py b/mycroft/client/speech/listener.py index 881fdb771a..77b190901c 100644 --- a/mycroft/client/speech/listener.py +++ b/mycroft/client/speech/listener.py @@ -119,6 +119,12 @@ class AudioConsumer(threading.Thread): self.metrics.increment("mycroft.wakeup") def process_audio(self, audio): + SessionManager.touch() + payload = { + 'utterance': self.mycroft_recognizer.key_phrase, + 'session': SessionManager.get().session_id, + } + self.emitter.emit("recognizer_loop:wakeword", payload) try: self.transcribe([audio]) except sr.UnknownValueError: # TODO: Localization From 7bcdea66049b96f8ff5262386a920dd326e1acc7 Mon Sep 17 00:00:00 2001 From: Matthew Scholefield Date: Tue, 21 Jun 2016 12:26:27 -0500 Subject: [PATCH 3/9] Added back wakeword handler --- mycroft/client/speech/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mycroft/client/speech/main.py b/mycroft/client/speech/main.py index a2f52f64b6..ed4f6ec64d 100644 --- a/mycroft/client/speech/main.py +++ b/mycroft/client/speech/main.py @@ -45,6 +45,11 @@ def handle_record_end(): client.emit(Message('recognizer_loop:record_end')) +def handle_wakeword(event): + logger.info("Wakeword Detected: " + event['utterance']) + client.emit(Message('recognizer_loop:wakeword', event)) + + def handle_utterance(event): logger.info("Utterance: " + str(event['utterances'])) client.emit(Message('recognizer_loop:utterance', event)) @@ -95,6 +100,7 @@ def main(): loop = RecognizerLoop(device_index=device_index) loop.on('recognizer_loop:utterance', handle_utterance) loop.on('recognizer_loop:record_begin', handle_record_begin) + loop.on('recognizer_loop:wakeword', handle_wakeword) loop.on('recognizer_loop:record_end', handle_record_end) loop.on('speak', handle_speak) client.on('speak', handle_speak) From 6dcf5a6f0b2c7f0f1ef98cc149e2b11c5056c45f Mon Sep 17 00:00:00 2001 From: Ethan Ward Date: Tue, 14 Jun 2016 11:19:10 -0500 Subject: [PATCH 4/9] Issues 86 - Add personal skill --- mycroft/skills/personal/__init__.py | 82 +++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 mycroft/skills/personal/__init__.py diff --git a/mycroft/skills/personal/__init__.py b/mycroft/skills/personal/__init__.py new file mode 100644 index 0000000000..f47e2ed73e --- /dev/null +++ b/mycroft/skills/personal/__init__.py @@ -0,0 +1,82 @@ +# 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 os.path import dirname + +from adapt.intent import IntentBuilder +from mycroft.skills.core import MycroftSkill +from mycroft.util.log import getLogger + +__author__ = 'eward' + +logger = getLogger(__name__) + + +class PersonalSkill(MycroftSkill): + + def __init__(self): + super(PersonalSkill, self).__init__(name="PersonalSkill") + + def initialize(self): + self.load_data_files(dirname(__file__)) + + when_were_you_born_intent = IntentBuilder("WhenWereYouBornIntent")\ + .require("WhenWereYouBornKeyword").build() + self.register_intent(when_were_you_born_intent, + self.handle_when_were_you_born_intent) + + where_were_you_born_intent = IntentBuilder("WhereWereYouBornIntent")\ + .require("WhereWereYouBornKeyword").build() + self.register_intent(where_were_you_born_intent, + self.handle_where_were_you_born_intent) + + who_made_you_intent = IntentBuilder("WhoMadeYouIntent")\ + .require("WhoMadeYouKeyWord").build() + self.register_intent(who_made_you_intent, + self.handle_who_made_you_intent) + + who_are_you_intent = IntentBuilder("WhoAreYouIntent")\ + .require("WhoAreYouKeyword").build() + self.register_intent(who_are_you_intent, + self.handle_who_are_you_intent) + + what_are_you_intent = IntentBuilder("WhatAreYouIntent")\ + .require("WhatAreYouKeyword").build() + self.register_intent(what_are_you_intent, + self.handle_what_are_you_intent) + + def handle_when_were_you_born_intent(self, message): + self.speak_dialog("when.was.i.born") + + def handle_where_were_you_born_intent(self, message): + self.speak_dialog("where.was.i.born") + + def handle_who_made_you_intent(self, message): + self.speak_dialog("who.made.me") + + def handle_who_are_you_intent(self, message): + self.speak_dialog("who.am.i") + + def handle_what_are_you_intent(self, message): + self.speak_dialog("what.am.i") + + def stop(self): + pass + + +def create_skill(): + return PersonalSkill() From b19f2022c9bd351a1b0c4f275636bfc812c86d59 Mon Sep 17 00:00:00 2001 From: Ethan Ward Date: Tue, 14 Jun 2016 11:19:33 -0500 Subject: [PATCH 5/9] Issues 86 - Add personal vocab --- mycroft/skills/personal/dialog/en-us/what.am.i.dialog | 1 + mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog | 1 + mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog | 1 + mycroft/skills/personal/dialog/en-us/who.am.i.dialog | 1 + mycroft/skills/personal/dialog/en-us/who.made.me.dialog | 1 + 5 files changed, 5 insertions(+) create mode 100644 mycroft/skills/personal/dialog/en-us/what.am.i.dialog create mode 100644 mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog create mode 100644 mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog create mode 100644 mycroft/skills/personal/dialog/en-us/who.am.i.dialog create mode 100644 mycroft/skills/personal/dialog/en-us/who.made.me.dialog diff --git a/mycroft/skills/personal/dialog/en-us/what.am.i.dialog b/mycroft/skills/personal/dialog/en-us/what.am.i.dialog new file mode 100644 index 0000000000..44cbc319a5 --- /dev/null +++ b/mycroft/skills/personal/dialog/en-us/what.am.i.dialog @@ -0,0 +1 @@ +i am an artificial intelligence diff --git a/mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog b/mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog new file mode 100644 index 0000000000..2b7f806514 --- /dev/null +++ b/mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog @@ -0,0 +1 @@ +i was born in 2015 diff --git a/mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog b/mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog new file mode 100644 index 0000000000..64d12438f2 --- /dev/null +++ b/mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog @@ -0,0 +1 @@ +the lawrence center for entrepreneurship diff --git a/mycroft/skills/personal/dialog/en-us/who.am.i.dialog b/mycroft/skills/personal/dialog/en-us/who.am.i.dialog new file mode 100644 index 0000000000..287452a081 --- /dev/null +++ b/mycroft/skills/personal/dialog/en-us/who.am.i.dialog @@ -0,0 +1 @@ +i am mycroft diff --git a/mycroft/skills/personal/dialog/en-us/who.made.me.dialog b/mycroft/skills/personal/dialog/en-us/who.made.me.dialog new file mode 100644 index 0000000000..71cc269fb8 --- /dev/null +++ b/mycroft/skills/personal/dialog/en-us/who.made.me.dialog @@ -0,0 +1 @@ +the wonderful mycroft a.i. community and team From 342e8b2e37209579d0783ad5c700e67375a409af Mon Sep 17 00:00:00 2001 From: Ethan Ward Date: Tue, 14 Jun 2016 11:22:24 -0500 Subject: [PATCH 6/9] Issues 86 - Add personal vocab --- mycroft/skills/personal/vocab/en-us/WhatAreYouKeyword.voc | 1 + mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc | 1 + mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc | 1 + mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc | 1 + mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc | 1 + 5 files changed, 5 insertions(+) create mode 100644 mycroft/skills/personal/vocab/en-us/WhatAreYouKeyword.voc create mode 100644 mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc create mode 100644 mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc create mode 100644 mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc create mode 100644 mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc diff --git a/mycroft/skills/personal/vocab/en-us/WhatAreYouKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhatAreYouKeyword.voc new file mode 100644 index 0000000000..7814b91395 --- /dev/null +++ b/mycroft/skills/personal/vocab/en-us/WhatAreYouKeyword.voc @@ -0,0 +1 @@ +what are you diff --git a/mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc new file mode 100644 index 0000000000..5f42fce7ad --- /dev/null +++ b/mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc @@ -0,0 +1 @@ +when were you born diff --git a/mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc new file mode 100644 index 0000000000..a4ca15dff3 --- /dev/null +++ b/mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc @@ -0,0 +1 @@ +where were you born diff --git a/mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc new file mode 100644 index 0000000000..3b7c54341a --- /dev/null +++ b/mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc @@ -0,0 +1 @@ +who are you diff --git a/mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc new file mode 100644 index 0000000000..74edaa0411 --- /dev/null +++ b/mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc @@ -0,0 +1 @@ +who made you From a39bfce789cc78ab04368bac5d869ba12534df0f Mon Sep 17 00:00:00 2001 From: Ethan Ward Date: Tue, 14 Jun 2016 11:22:41 -0500 Subject: [PATCH 7/9] Issues 86 - Add personal tests --- .../skills/personal/test/intent/what.are.you.intent.json | 7 +++++++ .../personal/test/intent/when.were.you.born.intent.json | 7 +++++++ .../personal/test/intent/where.were.you.born.intent.json | 7 +++++++ .../skills/personal/test/intent/who.are.you.intent.json | 7 +++++++ .../skills/personal/test/intent/who.made.you.intent.json | 7 +++++++ 5 files changed, 35 insertions(+) create mode 100644 mycroft/skills/personal/test/intent/what.are.you.intent.json create mode 100644 mycroft/skills/personal/test/intent/when.were.you.born.intent.json create mode 100644 mycroft/skills/personal/test/intent/where.were.you.born.intent.json create mode 100644 mycroft/skills/personal/test/intent/who.are.you.intent.json create mode 100644 mycroft/skills/personal/test/intent/who.made.you.intent.json diff --git a/mycroft/skills/personal/test/intent/what.are.you.intent.json b/mycroft/skills/personal/test/intent/what.are.you.intent.json new file mode 100644 index 0000000000..fa1a023f5a --- /dev/null +++ b/mycroft/skills/personal/test/intent/what.are.you.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "what are you", + "intent_type": "WhatAreYouIntent", + "intent": { + "WhatAreYouKeyword": "what are you" + } +} diff --git a/mycroft/skills/personal/test/intent/when.were.you.born.intent.json b/mycroft/skills/personal/test/intent/when.were.you.born.intent.json new file mode 100644 index 0000000000..c3aa4c88e5 --- /dev/null +++ b/mycroft/skills/personal/test/intent/when.were.you.born.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "when were you born", + "intent_type": "WhenWereYouBornIntent", + "intent": { + "WhenWereYouBornKeyword": "when were you born" + } +} diff --git a/mycroft/skills/personal/test/intent/where.were.you.born.intent.json b/mycroft/skills/personal/test/intent/where.were.you.born.intent.json new file mode 100644 index 0000000000..39540a427b --- /dev/null +++ b/mycroft/skills/personal/test/intent/where.were.you.born.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "where were you born", + "intent_type": "WhereWereYouBornIntent", + "intent": { + "WhereWereYouBornKeyword": "where were you born" + } +} diff --git a/mycroft/skills/personal/test/intent/who.are.you.intent.json b/mycroft/skills/personal/test/intent/who.are.you.intent.json new file mode 100644 index 0000000000..623e7364b4 --- /dev/null +++ b/mycroft/skills/personal/test/intent/who.are.you.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "who are you", + "intent_type": "WhoAreYouIntent", + "intent": { + "WhoAreYouKeyword": "who are you" + } +} diff --git a/mycroft/skills/personal/test/intent/who.made.you.intent.json b/mycroft/skills/personal/test/intent/who.made.you.intent.json new file mode 100644 index 0000000000..899fd83d2e --- /dev/null +++ b/mycroft/skills/personal/test/intent/who.made.you.intent.json @@ -0,0 +1,7 @@ +{ + "utterance": "who made you", + "intent_type": "WhoMadeYouIntent", + "intent": { + "WhoMadeYouKeyWord": "who made you" + } +} From ac7fb50de9ccf8484cc940e84b2f2aa1b3042931 Mon Sep 17 00:00:00 2001 From: Ethan Ward Date: Mon, 20 Jun 2016 17:34:17 -0500 Subject: [PATCH 8/9] Issues 86 - Add additional dialog and vocab --- mycroft/skills/personal/dialog/en-us/what.am.i.dialog | 3 ++- mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog | 3 ++- mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog | 3 ++- mycroft/skills/personal/dialog/en-us/who.am.i.dialog | 3 ++- mycroft/skills/personal/dialog/en-us/who.made.me.dialog | 3 ++- mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc | 1 + .../skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc | 1 + mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc | 1 + mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc | 1 + 9 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mycroft/skills/personal/dialog/en-us/what.am.i.dialog b/mycroft/skills/personal/dialog/en-us/what.am.i.dialog index 44cbc319a5..e71135da80 100644 --- a/mycroft/skills/personal/dialog/en-us/what.am.i.dialog +++ b/mycroft/skills/personal/dialog/en-us/what.am.i.dialog @@ -1 +1,2 @@ -i am an artificial intelligence +I am an open source artificial intelligence. +I'm an intelligent piece of software for communicating with machines \ No newline at end of file diff --git a/mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog b/mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog index 2b7f806514..8ac7db3861 100644 --- a/mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog +++ b/mycroft/skills/personal/dialog/en-us/when.was.i.born.dialog @@ -1 +1,2 @@ -i was born in 2015 +I was born in 2015. +2015 is when I was born. diff --git a/mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog b/mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog index 64d12438f2..10c9320785 100644 --- a/mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog +++ b/mycroft/skills/personal/dialog/en-us/where.was.i.born.dialog @@ -1 +1,2 @@ -the lawrence center for entrepreneurship +The Lawrence Center for Entrepreneurship. +I was born in Lawrence, Kansas. diff --git a/mycroft/skills/personal/dialog/en-us/who.am.i.dialog b/mycroft/skills/personal/dialog/en-us/who.am.i.dialog index 287452a081..112ef91312 100644 --- a/mycroft/skills/personal/dialog/en-us/who.am.i.dialog +++ b/mycroft/skills/personal/dialog/en-us/who.am.i.dialog @@ -1 +1,2 @@ -i am mycroft +I'm Mycroft. Didn't you know that? +I'm Mycroft, an open-source A.I. \ No newline at end of file diff --git a/mycroft/skills/personal/dialog/en-us/who.made.me.dialog b/mycroft/skills/personal/dialog/en-us/who.made.me.dialog index 71cc269fb8..7077089719 100644 --- a/mycroft/skills/personal/dialog/en-us/who.made.me.dialog +++ b/mycroft/skills/personal/dialog/en-us/who.made.me.dialog @@ -1 +1,2 @@ -the wonderful mycroft a.i. community and team +The wonderful Mycroft A.I. community and team. +Everyone in the Mycroft A.I. community and team. diff --git a/mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc index 5f42fce7ad..9dec489c41 100644 --- a/mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc +++ b/mycroft/skills/personal/vocab/en-us/WhenWereYouBornKeyword.voc @@ -1 +1,2 @@ when were you born +when were you created diff --git a/mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc index a4ca15dff3..3730205298 100644 --- a/mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc +++ b/mycroft/skills/personal/vocab/en-us/WhereWereYouBornKeyword.voc @@ -1 +1,2 @@ where were you born +where were you created diff --git a/mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc index 3b7c54341a..d0ba3f6d3d 100644 --- a/mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc +++ b/mycroft/skills/personal/vocab/en-us/WhoAreYouKeyword.voc @@ -1 +1,2 @@ who are you +who're you diff --git a/mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc b/mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc index 74edaa0411..7997546735 100644 --- a/mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc +++ b/mycroft/skills/personal/vocab/en-us/WhoMadeYouKeyword.voc @@ -1 +1,2 @@ who made you +who were you made by From 2a2d3044c742a666b843c57b8ba34636f442ce9c Mon Sep 17 00:00:00 2001 From: Ethan Ward Date: Tue, 21 Jun 2016 14:44:05 -0500 Subject: [PATCH 9/9] Issues 86 - Fix wording --- mycroft/skills/personal/dialog/en-us/who.am.i.dialog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mycroft/skills/personal/dialog/en-us/who.am.i.dialog b/mycroft/skills/personal/dialog/en-us/who.am.i.dialog index 112ef91312..09d689474e 100644 --- a/mycroft/skills/personal/dialog/en-us/who.am.i.dialog +++ b/mycroft/skills/personal/dialog/en-us/who.am.i.dialog @@ -1,2 +1,2 @@ -I'm Mycroft. Didn't you know that? +My name is Mycroft and I'm an intelligent personal assistant I'm Mycroft, an open-source A.I. \ No newline at end of file