- You can complete GrokLearning’s introductory “Is Eliza Human?” lesson, which will introduce you to the Python programming language and allow you to build a basic chatterbot, which you might think of as a rudimentary interactive fiction. Kevin, Areti, and I will be circulating to help with this, but I would encourage you to work in groups as I will be focused on those taking option #2.To complete the assignment using this option, you should submit:
- A plaintext file (a file with the .txt extension created in Wordpad or TextEdit) with your final code from the GrokLearning course.
- A short reflection (no more than 3 paragraphs) focused on how this exercise helped you think about the creative or literary possibilities of code (or lack thereof)
- If you’re feeling more ambitious, you can work with me to code your very own Twitterbot. This exercise doesn’t require any previous coding experience, but it will require a bit more willingness to experiment, and perhaps bump up against a wall or two on your way. Unlike the first option, however, if you take this one you’ll leave with a real “thing,” albeit an online thing, to your name. If you want to take this option, follow the directions below.
Create a Twitterbot
Okay, let’s break this down. There will be lots of steps here, but we will work through them together.
- Let’s look at a few files together to begin thinking about our goals for this lab:
- A twitterbot program I wrote that adapts some of Mark Sample’s code to inserts a random trending hashtag into two lines of Edgar Allan Poe’s “The Raven.” My version of this code posts its results to Quoth the Ravbot.
- First, we’ll need to install some software:
- To write a program in Python, we’ll need Python installed. If you work on a Mac, Python should already be installed. If you have a Windows machine, you may need to install it.
- We will need to install a few Python modules. Pip makes this easier, if you want to install it now. For those comfortable on the terminal, you can just run
sudo apt-get install python-pip.
- Once Pip is installed, we’ll be using it to install (at least) the wordnik, tweepy, and inflect modules. We should do this together.
- Finally, we need a good program to in which to write Python code. If you already have a program for this purpose, all to the good. Otherwise, download and install Komodo Edit to use writing our Python twitter-bot applications.
- Finally, we want to set Komodo Edit up to execute Python code within the application. To do this follow the two steps illustrated here:
- Next, we’ll need to create a few accounts from which we’ll either be drawing or to which we’ll be adding content:
- Sign up for a Wordnik account (Wordnik is an open-source dictionary) and then sign up for a Wordnik API Key.
- You will also need to create a new Twitter account for your bot. Think about what kind of bot you want to make and then sign up. Be sure to add a mobile number to the account, as we’ll need that for one the steps later on.
- While signed into your new account, visit Twitter’s developer site. In the small bottom menu click “Manage Your Apps” and then “Create New App.” Fill out the required fields and then click “Create Your Twitter Application.” In your new app, navigate to “Permissions,” select “Read and Write,” and save settings. We’ll be getting some essential information from the “Keys and Access Tokens” menu shortly.
- Now we’ll need to download a few files for the lab. These files were created by or adapted from the work of Mark Sample, who has done significant work creating and thinking about bots as expressive media (as you can see from his most recent post, “Closed Bots and Green Bots”:
- A basic text generation program written by Sample for beginning to learn Python’s syntax.
- A slightly more complicated program by Sample that remixes William Carlos Williams’ poem “This Is Just to Say” by drawing random words from the Wordnik API.
- My first attempt to modify Sample’s code to automatically remix a line from Edgar Allan Poe’s “The Raven.”.
- From here, honestly, it will all be about copying and pasting, experimenting, and seeing what happens with different combinations. If we get this far today we’ll move forward as a group.