Home For Fiction – Blog

for thinking people


javascript

Fiction Sentiment Analysis: Examples and Methods

September 19, 2022

The term “sentiment analysis” in the contexts of texts refers to a program (to put it simply) that detects emotions in a text. A typical application is for detecting whether clients are happy or angry, but large-scale analysis – for instance, analyzing tweets – can also give a sense of public opinion on a matter. I’m not interested in any of that. Instead, I wanted to experiment with fiction sentiment analysis.

What kind of applications could it have? How difficult is it to implement?

That’s what we’ll be looking at in this post. Though I’ll offer you details and links along the way, I’ll also keep it accessible to a lay audience. Whether you’re a beginner/intermediate programmer looking for ideas, or simply someone interested in seeing the possibilities, there’s something here that will interest you.

Sneak preview: I’ll also share with you a link to my program, so that you can perform a fiction sentiment analysis on your novel or short story!

(more…)

My 48K Challenge: A Programming Lesson on Creativity

June 13, 2022

There are all sorts of asinine challenges in the ocean of mediocrity that is social media, and let me assure you, this isn’t one of them. My “48K challenge” is something I came up with when I noticed something disturbing on my “smart” phone: The size of the calculator app is 8MB. That of the alarm clock is 19MB. And my personal favorite, the messages app (just SMS, that is) is a whooping 204MB.

Are these people serious?

When I was a kid, you could pack an entire video game in 48KB. In other words, the space the calculator app requires is the equivalent of more than 165 video games for the ZX Spectrum – my first computer.

It goes without saying that technology has advanced a lot; the games of the 80s can’t be technically compared to those we have today. And yet, it feels programming has become sloppy.

I’m of course generalizing, but it feels as if the more the resources we have, the less the creativity and the greater our laziness. It all leads to resource hogs that take too much space and are often buggy. Because, hey, let’s all keep updating all the time.

And so, I gave myself what I termed the 48K challenge. I decided to make a retro-style video game in JavaScript, that had to be 48KB or less. The results were intriguing and revealing – and a little bit disappointing, but not in the way you imagine.

48k challenge
Here’s a screenshot from the result of my 48K challenge. The acuity of the image is deliberately low. I coded the program in 256×192 pixels (the native ZX Spectrum resolution) which I then quadrupled, to emulate the loss of acuity when projected on a TV, as we did in the 80s monitor.
(more…)

Planet Generator: A Tool for SciFi and Fantasy Authors

May 16, 2022

Astronomy is one of my hobbies, and I’m particularly intrigued by exoplanets – planets beyond our solar system. Combining this interest with my coding and writing experience, I thought to make this JavaScript Planet Generator program. Not only does it create graphical representations of such fascinating worlds, it also generates random civilizational data that might be helpful for science fiction and fantasy authors.

In other words, whether you’re a scifi/fantasy author looking for worldbuilding prompts, a programmer looking for inspiration and/or tips, or simply someone interested in the universe, there’s definitely something in Planet Generator that will interest you.

planet generator
Here’s how the results page of Planet Generator looks like
(more…)