Skip to content
Error

Failed to copy link to the clipboard.

Success

Link copied to the clipboard.

Introduction

A chatbot is an interactive piece of software that responds to user input. Examining the code that constitutes the chatbot requires a degree of programming literacy. But in thinking about how to read a chatbot, we also come up against a number of methodological and pedagogical questions around what reading, and close reading, might mean in a digital context.

EgoBot

To give you a sense of how a very, very basic chatbot works (and where NLP comes into this), I have written one here in Python 3.7. Meet EgoBot:

EgoBot is a text interface and works on the basis of a set of very simple rules. After introducing itself, EgoBot asks you a question with two (predetermined but unspecified) reply options: “Do you want to chat? [yes/no]” It then waits for the user input. If the input is exactly equal to “yes,” then EgoBot returns another question (or conversational node) along that conversational pathway (namely, do you want to learn about Masterman or Coetzee). If the input is exactly equal to “no,” then EgoBot returns a question along that pathway, namely “Are you sure?” If the input is equal to neither option, EgoBot returns the comment “You aren’t talking my language; I don’t understand.” The conversational logic here resembles a tree: a series of branched choices. Once a branch comes to an end, a rule determines that the “end of chat” message will be returned to the user.

Now on the face of it, EgoBot offers an interface that utilizes NLP (it can handle the user’s input) to respond to a user, offering a series of conversational responses that progress along a logical course. However, it is also emphatically unintelligent and inflexible. EgoBot needs exact correspondence between anticipated user input and actual user input. If the user responded to Node 0 with “Coetzee” or “jm coetzee” or “coetze,” EgoBot would fail to recognize a string match and print: “You aren't talking my language; I don’t understand.” (I have included code to prevent capitalization/lowercase distinctions from producing such an error.) This exact correspondence is a weakness of this kind of rule-based program (and often drives users crazy). There are ways around it – coding for likely alternative user inputs – but it requires the programmer to predict and code for this variation of response. Such an act of prediction is inherently tied up with social and cultural assumptions about the imagined user which, as we have seen with our chatbots, can be deeply problematic.

A slightly more sophisticated chatbot might utilize more complicated rules. ELIZA for example utilizes a series of rules to identify keywords in the user input and respond with a corresponding probe or question. Utilizing the NLP techniques discussed here, the program can parse the user input, tagging parts of speech, chunking noun phrases, etc., in order to approximate the meaning of the input and provide a (rule-governed) response. Note that the developer has determined which NLP techniques should be utilized by the program and thus has predetermined (although to a lesser extent) what factors will be important for conceptualizing meaning.

So-called self-learning chatbots offer another step towards developing more “intelligent” interfaces. Some now utilize retrieval-based systems, drawing on massive libraries of prior user responses in order to tailor their own responses. Cleverbot, for example, before responding to a user input, searches through its prior saved conversations in order to determine how human users have responded to that input in the past. It can then use this information to return a more “realistic” response.

The training data are hugely important in such settings. Microsoft’s Tay offers a warning story. In March 2016 Microsoft released Tay, a Twitter bot “designed to engage and entertain people where they connect with each other online through casual and playful conversation. The more you chat with Tay the smarter she gets, so the experience can be more personalized for you.”1 Unfortunately, for Microsoft, personalization did not work as anticipated: Tay was targeted by various internet trolls and quickly began to spout deeply racist, sexist, and far-right ideologies. Within twenty-four hours Tay had to be taken down. Public handwringing and apologies followed.2 Although Tay offers an extreme example, the project indicates that systems will “learn” from the data with which they are provided. Considering the underlying biases and cultural orientations that such data encode is a crucial part of conducting ethical AI.

Endnotes

  1. “Tay,” Microsoft, April 14, 2016, https://web.archive.org/web/20160414074049/https:/www.tay.ai/.
  2. Peter Lee, “Learning from Tay’s Introduction,” The Official Microsoft Blog, March 25, 2016, https://blogs.microsoft.com/blog/2016/03/25/learning-tays-introduction/.

Bibliography

  • Lee, Peter. “Learning from Tay’s Introduction.” The Official Microsoft Blog, March 25, 2016. https://blogs.microsoft.com/blog/2016/03/25/learning-tays-introduction/.
  • Microsoft. “Tay,” April 14, 2016. https://web.archive.org/web/20160414074049/https:/www.tay.ai/.