Merge branch 'master' into feature/deb-packaging
commit
13fcb066f4
|
@ -119,6 +119,12 @@ class AudioConsumer(threading.Thread):
|
||||||
self.metrics.increment("mycroft.wakeup")
|
self.metrics.increment("mycroft.wakeup")
|
||||||
|
|
||||||
def process_audio(self, audio):
|
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:
|
try:
|
||||||
self.transcribe([audio])
|
self.transcribe([audio])
|
||||||
except sr.UnknownValueError: # TODO: Localization
|
except sr.UnknownValueError: # TODO: Localization
|
||||||
|
|
|
@ -45,6 +45,11 @@ def handle_record_end():
|
||||||
client.emit(Message('recognizer_loop: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):
|
def handle_utterance(event):
|
||||||
logger.info("Utterance: " + str(event['utterances']))
|
logger.info("Utterance: " + str(event['utterances']))
|
||||||
client.emit(Message('recognizer_loop:utterance', event))
|
client.emit(Message('recognizer_loop:utterance', event))
|
||||||
|
@ -95,6 +100,7 @@ def main():
|
||||||
loop = RecognizerLoop(device_index=device_index)
|
loop = RecognizerLoop(device_index=device_index)
|
||||||
loop.on('recognizer_loop:utterance', handle_utterance)
|
loop.on('recognizer_loop:utterance', handle_utterance)
|
||||||
loop.on('recognizer_loop:record_begin', handle_record_begin)
|
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('recognizer_loop:record_end', handle_record_end)
|
||||||
loop.on('speak', handle_speak)
|
loop.on('speak', handle_speak)
|
||||||
client.on('speak', handle_speak)
|
client.on('speak', handle_speak)
|
||||||
|
|
|
@ -137,8 +137,6 @@ class ResponsiveRecognizer(speech_recognition.Recognizer):
|
||||||
|
|
||||||
def __init__(self, wake_word_recognizer):
|
def __init__(self, wake_word_recognizer):
|
||||||
speech_recognition.Recognizer.__init__(self)
|
speech_recognition.Recognizer.__init__(self)
|
||||||
self.daemon = True
|
|
||||||
|
|
||||||
self.wake_word_recognizer = wake_word_recognizer
|
self.wake_word_recognizer = wake_word_recognizer
|
||||||
self.audio = pyaudio.PyAudio()
|
self.audio = pyaudio.PyAudio()
|
||||||
|
|
||||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
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()
|
|
@ -0,0 +1,2 @@
|
||||||
|
I am an open source artificial intelligence.
|
||||||
|
I'm an intelligent piece of software for communicating with machines
|
|
@ -0,0 +1,2 @@
|
||||||
|
I was born in 2015.
|
||||||
|
2015 is when I was born.
|
|
@ -0,0 +1,2 @@
|
||||||
|
The Lawrence Center for Entrepreneurship.
|
||||||
|
I was born in Lawrence, Kansas.
|
|
@ -0,0 +1,2 @@
|
||||||
|
My name is Mycroft and I'm an intelligent personal assistant
|
||||||
|
I'm Mycroft, an open-source A.I.
|
|
@ -0,0 +1,2 @@
|
||||||
|
The wonderful Mycroft A.I. community and team.
|
||||||
|
Everyone in the Mycroft A.I. community and team.
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"utterance": "what are you",
|
||||||
|
"intent_type": "WhatAreYouIntent",
|
||||||
|
"intent": {
|
||||||
|
"WhatAreYouKeyword": "what are you"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"utterance": "when were you born",
|
||||||
|
"intent_type": "WhenWereYouBornIntent",
|
||||||
|
"intent": {
|
||||||
|
"WhenWereYouBornKeyword": "when were you born"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"utterance": "where were you born",
|
||||||
|
"intent_type": "WhereWereYouBornIntent",
|
||||||
|
"intent": {
|
||||||
|
"WhereWereYouBornKeyword": "where were you born"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"utterance": "who are you",
|
||||||
|
"intent_type": "WhoAreYouIntent",
|
||||||
|
"intent": {
|
||||||
|
"WhoAreYouKeyword": "who are you"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"utterance": "who made you",
|
||||||
|
"intent_type": "WhoMadeYouIntent",
|
||||||
|
"intent": {
|
||||||
|
"WhoMadeYouKeyWord": "who made you"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
what are you
|
|
@ -0,0 +1,2 @@
|
||||||
|
when were you born
|
||||||
|
when were you created
|
|
@ -0,0 +1,2 @@
|
||||||
|
where were you born
|
||||||
|
where were you created
|
|
@ -0,0 +1,2 @@
|
||||||
|
who are you
|
||||||
|
who're you
|
|
@ -0,0 +1,2 @@
|
||||||
|
who made you
|
||||||
|
who were you made by
|
Loading…
Reference in New Issue