Lab #12: Script(ing) 1



Today’s lab will have two options, depending on how ambitious you’re feeling:

  1. 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:
    1. A plaintext file (a file with the .txt extension created in Wordpad or TextEdit) with your final code from the GrokLearning course.
    2. 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)
  2. 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.

  1. 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.
    • We won’t be doing anything this challenging today, but I also created IshmaFML (sound it out) and AhaBlessed using similar methods. If you want to mash up two different sources like this (and you have some Javascript experience) we can talk.
  2. 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:
      Trendingmore.py (~-Dropbox-Teaching-Technologies of Text-Python-f14tot)pythonProperties
  3. 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.
  4. 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”:
  5. 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.

One thought on “Lab #12: Script(ing)

Comments are closed.