About - PGP - Github

stormkit

When creating artwork I usually have to make custom tools, these tools are often quite useful, as they are designed specifically by me for a task that is usually strange or perhaps where the solution is not as readily available online. They include tools to help analyse metadata and language as well as more visual solutions to help the creation of generative art.

I've been asked multiple times about how I go about creating these tools and whether I would make them open source so now, one by one I will be making them open source and adding them to my python module 'stormkit'.

First is my multiple mood sentiment analysis based on the 'bag of words' model. This class is created for two purposes, to extract the degree of multiple emotions from text (currently positivity, negativity, anger, worry, sadness and scare) and to do this in a lightweight and fast manor, allowing large computations of small text (e.g. tweets) at significantly fast speeds. It's a great class that is at the heart of both "The Watsons, 2016" and "A.M.I, 2017". It's also incredibly simple to use.


How to use stormkit

stormkit is written in python and can be installed easily with pip, alternativly the git repo for the module is here. To install with pip simply run:

pip install stormkit

To initiate the class call

sentiment = MultiMoodSentimentAnalysis()

To analyse a string call the function analyse_text(), this will return a 'SentimentResult' object

result = sen.analyse_text("I hate Trump, I'm furious, but I love ice cream.")

To check if any errors occurred simply check the error variable, this should be done whenever creating a new 'SentimentResult' object

if result.error is None: print(result.decimals) else: print(result.error)

To get the results of the sentiment analysis use one of the following

# this is the raw data, including everything from words matched, # occurrences and different types of mood. Good for debugging result.raw # this returns an array containing the string of the dominant # emotion(s) within the text, note - this can be more than one result.majority_emotion # this returns the decimals of emotions within the text # (in a dictionary), this is a float within the value of 0.0 # and 1.0, the emotion name is the key result.decimals # this returns an array containing the words that were matched for # the specified emotion, for example ["sad", "upset"] result.words_for_emotion("angry")
Joe McAlister