The Thought Identification System, or TIS, is the name of the technology used in the Eve Polastri Chatbot.
Using machine learning and designed in the form of a web application, Eve Polastri Chatbot is a text-based chatting experience based on the hit BBC America show, Killing Eve. The goal of this project is to provide fans of the show with an opportunity to engage with one of its main characters, Eve Polastri, in the narrative space after the cliffhanger of the second season of the television show.
In this experience, Eve, after being shot, is now in a coma at an MI6 medical facility in London. The user is put in the role of a newly hired MI6 agent and tasked to talk to Eve’s mind through a newly developed technology called the Thought Identification System. By texting back and forth with Eve, the user gets to learn more about her, and ultimately, retrieves information from her regarding Villanelle's whereabouts.
A project by Carrie Sijia Wang and Ellen Nickles as part of the AMC Project Development Studio, Summer 2019. Pesented at NYC Media Lab's AMC Networks: Synthetic Media & The Future of Storytelling, September 2019.
With guidance and code adapted from Allison Parrish
Dear Future Carries and Ellens,
Here's some useful information to run this project on your computers. Let's break it into several parts.
We need a corpus of conversational turns to use Allison's Semantic Similarity Chatbot.
-
Create a spreadsheet with four columns (no headers)--the code in
tis_setup.py
relies on this structure: row number, data source, speaker's name, and speaker's line. In our project, the Killing Eve character Eve Polastri always responds on an even-numbered row. When the project is running the chatbot works, Allison writes, "as a kind of search engine. When you type something into the chat, the chatbot searches its database for the most appropriate [in our case, 'Eve'] response." -
Note the total number of lines for the document and divide it by 2 to retrieve the amount of conversational turns in our corpus. E.g. If the total number is 2,860, then we have 1,430 conversational turns. In Part 3, we will update
tis_setup.py
with the number of turns. -
Export the completed spreadsheet as a tab-separated values file named
lines.tsv
. We can call this file whatever we want. Just be sure to update the filename intis_setup.py
.
(Our data file is not stored in this repository.)
- Clone this repository onto your machine.
- In your terminal window,
cd
into the newly-cloned directorytis-services
. - Create a virtual environment with
python3 -m venv venv
. - Activate the virtual environment with
source venv/bin/activate
. - Install the packages listed in the
requirements.txt
. You should be able to do this all at once, but theen-core-web-lg==2.1.0
spaCy model throws an error and prevents me from doing this. I ran short on time to troubleshoot (suggestions welcome!), so here's a list of everything to pip install instead:
pip install wheel
pip install Flask
pip install spacy
python -m spacy download en_core_web_lg
pip install simpleneighbors
pip install https://github.com/aparrish/semanticsimilaritychatbot/archive/master.zip
- Create two directories:
mkdir data
andmkdir chatbotdb
Before any chitchat, set up the bot database and test it with these steps:
- Move the data file,
lines.tsv
, into thedata
directory. - Open
tis-setup.py
and update the number of conversational turns, a variable aptly named,numTurns
, with the amount you retrieved in Part 1. Make sure to save the file after this change! - Execute the file with
python tis_setup.py
. This will create and save the chatbot database into the directorychatbotdb
. There is some code in this file to test that the chatbot is working properly, but it is commented out. It's much more fun to test the chatbot withtis_test.py
. - So let's take it for whirl! Run
python tis_test.py
, and converse with the chatbot through your terminal window. Simply typeend session
when you're satisfied that the responses are indeed the ones you bundled together in Part 1.
Type python server.py
in your terminal window, and visit http://localhost:5000/
in your browser window to start the experience.
What about those files, chatbot.ini
and wsgi.py
, you ask? At one point this project was (still is?) deployed on a Digital Ocean droplet, and those files are for that specific environment. Here are the tutorials we used, although it's the future now so no guarantee these links still work: