Home For Fiction – Blog

for thinking people


sonnet

BardBot, a Shakespearean Chatbot

December 28, 2020

Remember my Shakespearean sonnet mixer? I was thinking, wouldn’t it be great if we could actually talk to the Bard and have him respond in his unique way to our questions? Well, of course it would have been, but alas, he’s dead. The next best thing – aren’t I modest? – is this BardBot; a JavaScript Shakespearean chatbot that takes the user input and returns a relevant line from the Bard’s sonnets.

The program takes the last word provided and returns either a direct reference (if the word exists in the sonnets database) or a rhyme (if it doesn’t).

In fact, I attempted to use more than just the last word (and I may attempt again in the future), but I wasn’t happy with the result. But even in this basic implementation, the BardBot results are pretty funny!

bardbot
Would the Bard approve? Probably not, but who cares!
(more…)

Making a Rhyming JavaScript Shakespearean Sonnet Mixer

January 13, 2020

My JavaScript iambic pentameter generator is among the most popular programming posts on Home for Fiction. It’s a really “alpha” piece of code which I haven’t worked on since I made that first version. But here’s a little something to compensate: let’s make a rhyming JavaScript Shakespearean sonnet mixer!

Unlike the iambic pentameter generator, this JavaScript Shakespearean sonnet mixer returns much more coherent results. After all, the code doesn’t need to generate any random text. It simply shuffles the Bard’s own production.

For a relevant project, also take a look at my poem shuffler.

To keep things simple, I decided to have it generate only two rhyming lines. The more the lines, the slower it would get – and the more likely it would not find any rhyming pairs.

JavaScript Shakespearean sonnet
To code or not to code?
(more…)