Equipping Alexa with self-programmed skills
More than a Word
Asking Alexa only for built-in functions like the weather report gets old quickly, and add-on skills from the skills store only go so far. With a few lines of code, Mike teaches this digital pet some new tricks.
Okay, I admit, I don't like getting up from the sofa to check out something on the Internet if my phone is out of reach. But who does? In the household of the future, a device like Amazon's Echo will be around to help you with things like this in the form of a tin can in the living room. The Amazon Echo Dot, which looks much like a hockey puck (Figure 1), is the successor to the tin-can-like Echo device and offers the same voice interface at a lower price point.
Amazon's dream, of course, might be that customers at home will just shout "Alexa, order toilet paper," to send the language assistant scurrying off to place the order with the Internet discounter, who then quickly dispatches a drone to deliver the much-needed household item to the anxiously waiting consumer.
Supposedly Safe
While the device constantly listens in the room, waiting to respond to the spoken word, it is in a kind of twilight state most of the time and does not forward incidental noise picked up by the microphone to the Amazon Cloud for analysis, according to the provider. Instead, the voice assistant waits for the user to speak what is known as the wake word, usually "Alexa," before activating the speech recognition-enabling connection to the Amazon Cloud. Instead of "Alexa," "Amazon," or "Echo," Star Trek fans can switch the wake word to "Computer" (Figure 2) and then talk to the assistant just as Captain Jean-Luc Picard spoke to the on-board computer on the bridge of the starship Enterprise.
Teaching Alexa New Tricks
Out the box, Alexa can answer simple questions. Skills [1], which are free thus far (but might well switch to the app payment model sometime in the future) are available from the Skills Store [2] (Figure 3). Skills are basically software packages programmed and published by third parties, much like apps in the App Store. From reading current share prices in a customized stock portfolio ("Motley Fool") through playing a game of Jeopardy, to controlling lamps in your smart home, you have a lot to choose from.
To teach Alexa a skill, you activate one in the Alexa smartphone app or simply speak into the microphone (e.g., "Alexa, enable The Fool"). A short time later, Alexa is familiar with the stock market via the Motley Fool skill and answers questions like "Ask The Fool how is the market doing today" or "Ask The Fool to add Microsoft to my watchlist."
If your fingers are itching at the thought of teaching Alexa to dance to your own tune, you can visit Amazon Developer Services [3] to set up an Alexa account, which is separate from Amazon's AWS business, designed for the development of Android apps (Figure 4). After approving the agonizingly long terms of service, click on the Alexa tab and then on Alexa Skills Kit [1] to view a list of home-grown skills programmed thus far (Figure 5), along with a button that reads Create New Skill.
Snapshot Output On-Call
As a practical example, I want Alexa to report on demand the title and date of the latest edition of the Snapshot programming column. To do so, Alexa reads a JSON file articles-en.json
from my site at Perlmeister.com behind the scenes. The file lists all the issues in reverse chronological order (Figure 6), picks up the first entry from the long list, extracts the month and year, and passes the two values back to the language processor, which in turn announces them to the user via the Echo Dot.
If I say, "Alexa, ask Latest Snapshot for issue," then Alexa forwards the question to the Latest Snapshot skill, which then retrieves and processes the data and returns an answer such as 04 2017, Home Run into the Cloud (if the April issue happens to be the latest published Linux Magazine).
The developer defines the name of the newly taught skill to which Alexa delegates requests below invocation name
in the web flow for new skills. Several words are allowed, but they must not contain keywords used elsewhere (e.g., "Alexa").
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.
-
Plasma Desktop Will Soon Ask for Donations
The next iteration of Plasma has reached the soft feature freeze for the 6.2 version and includes a feature that could be divisive.
-
Linux Market Share Hits New High
For the first time, the Linux market share has reached a new high for desktops, and the trend looks like it will continue.
-
LibreOffice 24.8 Delivers New Features
LibreOffice is often considered the de facto standard office suite for the Linux operating system.
-
Deepin 23 Offers Wayland Support and New AI Tool
Deepin has been considered one of the most beautiful desktop operating systems for a long time and the arrival of version 23 has bolstered that reputation.