Home For Fiction – Blog

for thinking people


javascript

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…)

Vocabulary Richness Ratio: a JavaScript Analyzer for Fiction Texts

August 18, 2020

I’ve been reading a lot of Yukio Mishima’s fiction lately. In awe of the richness of his vocabulary, I decided to code a little program that analyzes a novel and tells us how diverse the author’s word choices are. Enter Vocabulary Richness Ratio, my newest JavaScript experiment!

Just like my Fiction Complexity Index attempt, the Vocabulary Richness Ratio is:

  • available to you to try here on this page.
  • a work-in-progress – in other words, take the results with a grain of salt.

I’ve combined my expertise in literature and creative writing together with my interest in coding, and this little program was the result. Again, I must emphasize that it’s only a work-in-progress. It can give you a hint of how rich the vocabulary of your book is, but it’s not exact science.

vocabulary richness ratio
Vocabulary Richness Ratio is a JavaScript program that finds unique words in a text and, together with other factors, estimates how diverse the book’s vocabulary is
(more…)

A JavaScript Poem Shuffler

July 18, 2020

As I’ve mentioned many times on the blog, meaning is a very fluid concept in literature. This fact inspired me to see what happens when we completely distort the author’s original intention, while still maintaining some minimal cohesion. This JavaScript poem shuffler was the result.

As the name perhaps implies, my JavaScript poem shuffler takes a poem and randomly reorganizes its lines.

Now, you might have two questions about this:

  • Doesn’t that render the poem meaningless?
  • Why should we care?

Amazingly, both these questions have the same answer, as we’ll see in more detail. Briefly, let me just say that this little coding exercise also provides us with excellent teaching material in terms of affective power and, indeed, the creation of meaning in literature.

JavaScript Poem Shuffler
Apparently chaotic patterns can still hold meaning – if they are predicated on affect. This JavaScript poem shuffler is a good example of this
(more…)