Open Source Artificial Intelligence: Mycroft.ai from source on Ubuntu Xenial

I want to integrate FolkBot with Mycroft.ai and so I am going to run from source

Source

get the repo from MycroftAI


⟫ git clone https://github.com/MycroftAI/mycroft-core.git
Cloning into 'mycroft-core'...
remote: Counting objects: 5745, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 5745 (delta 5), reused 2 (delta 2), pack-reused 5725
Receiving objects: 100% (5745/5745), 74.60 MiB | 15.06 MiB/s, done.
Resolving deltas: 100% (3264/3264), done.
Checking connectivity... done.
[email protected]:~/Infra⟫ cd mycroft-core/

Setup

Lets set-up the pre-req’s etc

WARNING: Read these scripts

set-up a Debian/Ubuntu host


./build_host_setup_debian.sh

dev set-up

set-up the dev tools for Ubuntu

NOTE: this took over an hour to complete


./dev_setup.sh

Start Mycroft AI

start mycroft with all the options


./mycroft.sh start
Mycroft service started
Mycroft skills started
Mycroft voice started
Mycroft cli--quiet started

mycroft ai CLI

from the mycroft official docs

interact with mycroft.ai via the CLI, we list the screens


screen -list
There are screens on:
20625.mycroft-cli--quiet (03/10/2017 01:50:50 PM) (Detached)
20552.mycroft-skills (03/10/2017 01:50:50 PM) (Detached)
20514.mycroft-service (03/10/2017 01:50:50 PM) (Detached)
16278.mycroft-skills (03/10/2017 01:50:50 PM) (Detached)
7248.mycroft-skills (03/10/2017 01:50:50 PM) (Detached)
5 Sockets in /var/run/screen/S-devekko.

connect to cli

connect via cli


screen -r 16351.mycroft-cli--quiet
requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device//setting HTTP/1.1" 401 38
requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai
requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/auth/token HTTP/1.1" 401 38
ConfigurationSkill - WARNING - Impossible to update configuration because device isn't paired

History Log Output Legend
====================================================================================================== ==================================================================================================
mycroft-skills.log, system debug
mycroft-skills.log, other
mycroft-voice.log

Input (':' for command mode, Ctrl+C to quit):
> What time is it

we learn we need to register, but mycroft can tell the time


requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/device//setting HTTP/1.1" 401 38
requests.packages.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.mycroft.ai
requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/auth/token HTTP/1.1" 401 38
ConfigurationSkill - WARNING - Impossible to update configuration because device isn't paired

History Log Output Legend
====================================================================================================== ==================================================================================================
mycroft-skills.log, system debug
mycroft-skills.log, other
mycroft-voice.log

Input (':' for command mode, Ctrl+C to quit):
> What time is it

History Log Output Legend
====================================================================================================== ==================================================================================================
>> 04:14, PM mycroft-skills.log, system debug
>> 04:14, PM mycroft-skills.log, other
>> 04:14, PM mycroft-voice.log
>> 04:14, PM
>> It's 04:14, PM

Register

at the mycroft homepage we register a device, it even tells us

NOTE: I made up below information


>> Log in at home dot mycroft dot A.I and enter the pairing code. 'C' as in Charlie. 'A' as in Alfred. 'B' as in Blueberries. 'K' as in Kilogram. 'H' as in Hotel. 'K' as in Kilogram

you are now registered and paired

News from mycroft

we can ask via command line for the news


{"type": "enclosure.eyes.blink", "data": {"side": "b"}, "context": null}
{"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}
{"type": "recognizer_loop:audio_output_start", "data": {}, "context": null}
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.22.4; written and copyright by Michael Hipp and others
free software (LGPL) without any warranty but with best wishes
{"type": "enclosure.eyes.blink", "data": {"side": "b"}, "context": null}
{"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}
{"type": "recognizer_loop:audio_output_start", "data": {}, "context": null}

Directory: http://play.podtrac.com/npr-500005/npr.mc.tritondigital.com/NPR_500005/media/anon.npr-mp3/npr/newscasts/2017/03/10/
Playing MPEG stream 1 of 1: newscast180642.mp3?orgId=1&d=300&p=500005&story=519730168&t=podcast&e=519730168&ft=pod&f=500005 ... MPEG 1.0 layer III, 192 kbit/s, 48000 Hz joint-stereo
Directory: http://play.podtrac.com/npr-500005/npr.mc.tritondigital.com/NPR_500005/media/anon.npr-mp3/npr/newscasts/2017/03/10/
Playing MPEG stream 1 of 1: newscast180642.mp3?orgId=1&d=300&p=500005&story=519730168&t=podcast&e=519730168&ft=pod&f=500005 ...

MPEG 1.0 layer III, 192 kbit/s, 48000 Hz joint-stereo
{"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}
{"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}
requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/wa?input=news HTTP/1.1" 200 23080 {"type": "speak", "data": {"utterance": "news (English word) : 1, n"}, "context": null}
{"type": "recognizer_loop:audio_output_start", "data": {}, "context": null}
{"type": "speak", "data": {"utterance": "news (English word) : 1, n"}, "context": null}
requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/wa?input=news HTTP/1.1" 200 23080
{"type": "speak", "data": {"utterance": "news (English word) : 1, n"}, "context": null}
{"type": "recognizer_loop:audio_output_start", "data": {}, "context": null} {"type": "speak", "data": {"utterance": "news (English word) : 1, n"}, "context": null} {"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}
{"type": "recognizer_loop:audio_output_start", "data": {}, "context": null}
{"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}
{"type": "recognizer_loop:audio_output_start", "data": {}, "context": null}
{"type": "enclosure.eyes.blink", "data": {"side": "b"}, "context": null}
{"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}
{"type": "enclosure.eyes.blink", "data": {"side": "b"}, "context": null}
{"type": "recognizer_loop:audio_output_end", "data": {}, "context": null}

History Log Output Legend
==================================================================================== ================================================================================
news mycroft-skills.log, system debug
>> Here is this hour's news from NPR. mycroft-skills.log, other
>> Here is the top of the hour news from NPR. mycroft-voice.log
>> news (English word) : 1, n
>> news (English word) : 1, n

Input (':' for command mode, Ctrl+C to quit):
>

play thew news on the speech screen


2017-03-10 19:04:29,897 - mycroft.client.speech.listener - DEBUG - STT: play the news
2017-03-10 19:04:29,897 - SpeechClient - INFO - Utterance: [u'play the news']
2017-03-10 19:04:32,460 - SpeechClient - INFO - Speak: I couldn't get a response for play the news.
Playing WAVE '/tmp/tts.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
2017-03-10 19:04:35,642 - SpeechClient - INFO - Speak: Maybe you meant play?
Playing WAVE '/tmp/tts.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
2017-03-10 19:06:32,185 - SpeechClient - INFO - Speak: PLAY (music work) : album, music act, release date, Tree, SEKAI NO OWARI, Thursday, January 15, 2015
Playing WAVE '/tmp/tts.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
2017-03-10 19:06:55,554 - SpeechClient - INFO - Speak: Jazz (book) : author, Toni Morrison, first publication date, 1992 (25 years ago), publisher, Knopf, original language, English
Playing WAVE '/tmp/tts.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
2017-03-10 19:08:39,723 - SpeechClient - INFO - Speak: Here is the top of the hour news from NPR.
Playing WAVE '/tmp/tts.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mo

make your own vocabulary

I want to add “radio news” to the vocabulary and change to the cli screen /mycroft-core/mycroft/skills/npr_news/vocab/en-us


radio news
>> Here is the top of the hour news from NPR.
Input (':' for command mode, Ctrl+C to quit):