My knowledge in Python is scant compared to JavaScript, though some years ago I did play with it a bit. Still, lately I’ve been interested in AI models, so I decided to give Python another go. As it turns out, it’s trivial to train some simple AI models with it. In today’s post, I’ll show you how I made a very simple literary genre detector.
AI models of this kind work in a very simple manner, conceptually speaking. They simply take as input a list of data the programmer has supplied in the form of [("love","positive"),
("care","positive"),
("hate","negative"), ("rage", "negative")
] and then return guesses for a supplied string. For example, a sentence like “love, care, and blah blah” (in this extremely simple example) would be classified as positive.
As you can appreciate, it all boils down to the quality of the data – garbage in, garbage out, and all that. So, with this important caveat in mind, let’s see what a literary genre detector looks like!
(more…)