amzn1.ask.skill.0800660f-f705-495a-ac96-542eba29111a
BackgroundI'm a parent. My kids love hearing stories, and I love sharing stories. Every night I try to think up a story for them, but I've run into a few problems:
1. Sometimes my reserves of creativity run dry. When that happens, this common scene strikes fear into my heart:
2. Sometimes I travel to conferences (Hello AWS re:Invent staff!), and can't tell my kids a story in person.
3. A possibly-mythical guy named Aesop already thought up a ton of short stories a long time ago so I don't have to, and...
4. Because I'm a geek, I'd rather write a bunch of code than come up with a simpler way to solve this problem.
What I made<FANFARE/> So! I've made an Alexa Skill to tell classic short stories, or fables. I can ask for a random story, and if it's a particularly good one, add it to my favorites. Later, I can ask for a story randomly chosen from among my favorites, or remove a favorite that has gotten stale. This way, I (and any other story aficionados out there) can curate their own personal collection.
Right now the library of stories just includes Aesop's fables. I hope to grow it over time, as I find additional content with permissive licensing.
How I made itI got the public-domain stories from Project Gutenberg, and then wrote code to parse the text and reformat it for clean speech. Specifically, I replaced double dashes with commas, removed underlines, and inserted newlines to make the stories flow better.
Then I studied Amazon's ScoreKeeper example, and repeatedly broke and fixed it until it told fables. Programming! Seriously, though I chose that example because it already implemented DynamoDB access, giving me a huge head start on saving/loading favorite stories. From there, I added logic for choosing which story to speak, and changed what got saved/loaded (favorites and last story heard). To run the code on AWS Lambda, zip the application code and upload it to a new Lambda function.
Finally, I added Cards and did some (maybe even enough!) testing.
How to use itOnce the skill is enabled on your Alexa-capable device, you can say "Alexa, ask Fables to tell me a story," and you're off to the races. If you get a particularly good one, follow that up with "Save that," and it will be added to your favorites. If you change your mind, say "Forget that" to delete it from your favorites. When you have some favorites, you can say "Tell me one of my favorite stories," and Alexa will choose from those.
Comments
Please log in or sign up to comment.