Why Bots?
Humans interact with each other via conversations. It is one of the earliest interfaces we learn, and is still the one most of us use most frequently. If a human required you to learn a new interface to communicate with them, you might find it pretentious and frustrating, but that is typically what machines ask of us. Their limitations have forced us to to learn very specific commands, such as knobs and buttons — we are communicating on their terms, not on ours
Wouldn’t it be nice if machines could understand our conversations, so that we can interact with them in a much more natural way? In addition to the useful aspects, being able to interact with a non-human entity in a human way itself is quite magical. I decided to check out the world’s only conference dedicated to the topic, Talkabot.
Talkabot was a showcase for many fascinating applications of conversational interfaces, but we were particularly interested in learning the tools and methodologies to build our own! We wanted to see how people would interact with a bot, and we wanted to understand the tech for Natural Language Processing (NLP). Thus was born band-name.exe…
Building band-name.exe
Band-name.exe lurks in our company’s Slack channels, listening for interesting band names. When it hears one, it will suggest “Hey. ____ ____ ____ (something you said) would make a cool band name.” At its most basic level, it does this by detecting specific grammatical patterns— such as “adverb adjective noun”, or “Adjective Noun but with the same first letter” (alliteration)… but there’s a little bit more magic there as well…
How did we make it?
To make band-name.exe understand which words are adjective, adverb, noun, etc. we need to utilize an NLP library that provides “Part-of-Speech Tagging”. We checked out a few libraries, and landed on nlp-compromise. While it’s not the most accurate or powerful NLP library, it is very lightweight and easy to use. Being written in Javascript (my mother-tongue) it also allows me to experiment quickly. Good enough for proving an idea.
Next, Band-name.exe gets its eyes and ears via botkit. It’s a chatbot framework built by Howdy (the people who host Talkabot each year). It is very convenient because it allows for coding the bot once and deploying to many platforms, including our company’s Slack.
Optimizations and Enhancements
We considered the factors that’ll make or break user impressions of the bot. The most important part is to make the bot feel like a human, preferably one with good judgment. Spam too many nonsensical band names and it becomes annoying and disruptive — especially in a work environment.
To calibrate, we estimated how many band names it would generate per week as well as their quality by running the scraping algorithm against 2.5 years of company chat records. The “Adv+Adj+Noun” pattern gave us 89 band names, and Alliteration pattern gave us 115. Combining these and dividing them by the number of weeks in 2.5 years, we got 1.5 band names per week, which felt like a good frequency.
One issue we discovered after looking at these results was that punctuations and special characters don’t work well with POS tagging. They get mistakenly tagged as part of the word, or changes the meaning of the word, creating nonsensical band names like ‘Practices” Page’, ‘So Far I’ve’. Emojis and @usernames are also recorded as special strings (:joy: and <@U176ABPI5|changbai>). We had to sanitize the pattern’s output to remove these bad names.
In addition, to further make sure bot messages don’t swamp the chat, the bot only suggests band names in the message’s thread, which can only be seen when clicked open.
And in the worst case scenario, we are able to put the bot on mute — simply by saying, “@band-name.exe mute.” Or if you’re extra frustrated, “@band-name.exe shut up.”
Reactions
In the last week of April, a bot was dropped to a few non-project-specific channels. It laid dormant for a while, with no one paying much attention…
But it didn’t take long for the seed to sprout. What was quite interesting was, it took even less time for people to start experimenting and teasing the bot.
Or could it be that people were actually trying to impress the bot?
Much like playing with dolls, we humanize the bot and give them personalities that aren’t part of their programming.
Our coworkers succeeded in figuring out the bot’s algorithm too, after extensive uh… experimentation.
As many silly nonsenses it has spout, band-name.exe was able to provide us some actually pretty good band names, often reflecting the topic of our conversation: “Low Latency”, “Mere Mortals”, “Particular Piece”, “Repetitive Robot”…
If you’d like to add band-name.exe to your own Slack, or create your own variation of it, the easiest way is to Remix it on Glitch! There’s also a list of tools you could utilize as well:
1) Botkit: A toolkit that helps letting the bot listen and respond to conversations.
2) compromise: NLP utility in javascript. Not the most accurate processing, but lightweight and easy to use.
3) natural: Fancier NLP for nodeJS.
4) In addition, Natural Language Toolkit (python) has been of great help for initial experimentation. It comes with the usual NLP functionalities, but also visualization tools, corpora & lexical resources, an active forum, and an online book that’s great for introducing NLP concepts.