Next, I’ll explain some of my recent tweets, which I posted over the course of building this application.

I built a sentiment analysis tool that can learn stuff by reading tweets. It figured out what a container is. Well, kind of. 😁 pic.twitter.com/tRiHexLoL9

In the tweet above, I was excited to discover a graph visualization that demonstrated how Linux containers were related to different phrases. I call this Neo4j Cypher query: a meme graph.

Memes are patterns or templates in natural language text that evolve and change over time. Twitter users will post variations of a meme, which will contain variable and static parts. The variable parts of a meme are limited to a subset of possible terms. To discover a meme in the Twitter graph, I can query for phrases that have multiple connections to tweets . By traversing tweets and their extracted phrases, I discovered potential memes by matching cycles and loops in entity relationships.

In the screenshot above, you’ll see a flow of looped connections between tweets and phrases. I’ve set a criteria on the results so that only phrases mentioned twice in the same tweet are displayed. This proved to be a really clever way to determine the most relevant phrases in the network. As it turns out, people do not often use the same phrase more than once in the same tweet. Which means, that for the users who do, they are conveying something of topical importance.

The tweet referenced above is a ranked extract of phrases that are colored and sized depending on their emotional context. Simply, I exported the graph of phrases and tweets into a visualization tool named Gephi . Gephi has a set of features that you can use to rank and visualize graph datasets. For me, this was a good proof of concept for understanding whether or not sentiment analysis could be used to infer the larger emotional context of important phrases in my Twitter network.

Visualizing the virulence of words

While putting together this blog post, I wanted to focus on determining how viral text could spread emotions. It turns out, there are academic papers that prove that emotional contagion can spread in social networks. This will be the topic of future blog posts, but I wanted to end this blog post with a quote from the father of memes, Richard Dawkins.

The shape of viral text on Twitter. 🦠🦠🦠 pic.twitter.com/QeRSb78ZmI — Kenny Bastani (@kennybastani) September 15, 2019

The most interesting thing I discovered from the data so far was related to memes. It turns out, that people construct and use memes to easily deliver meaningful information on Twitter without knowing. Memes serve as a template where static and variable parts of text provide a familiar backbone for understanding many different aspects of the intended meaning of a tweet. There are the memes we, of course, know and intend to use. There are also memes that we often use that convey meaning but are not intentional, and are not obvious.

The shape of the connected data appears to also show that biological patterns evolve from the variations of memes that connect tweets and phrases together. This was first predicted by Dawkins, in his book The Selfish Gene, where he coins the term meme.

I believe that, given the right conditions, replicators automatically band together to create systems, or machines, that carry them around and work to favour their continued replication. — Richard Dawkins

The Selfish Gene (1976)

There is an interesting body of work behind this idea, thanks to Dawkins. But we should ask, why would there be biologically mimetic patterns in the graph structure that I queried?

Because memes use natural selection to reproduce and evolve in the same way that biological organisms do, using genes. Both mechanisms are based on the translation and expression of information in the form of graphs, which Dawkins first wrote about over 40 years ago. Information is at the core of gene expression into molecular proteins, with organisms as the driver. Information is also at the core of language’s expression into meaningful behavior, with emotion as the driver.

With only a little imagination we can see the gene as sitting at the centre of a radiating web of extended phenotypic power. And an object in the world is the centre of a converging web of influences from many genes sitting in many organisms. The long reach of the gene knows no obvious boundaries. The whole world is criss-crossed with causal arrows joining genes to phenotypic effects, far and near. — Richard Dawkins

The Selfish Gene (1976)