If Text Then Code

  • About the Course
    • Course Goals
    • Course Modules
  • Important Information
    • Contact Me
    • Policies
  • Schedule
  • Assignments
    • Reflection Posts
      • Prompt #1
      • Prompt #2
      • Prompt #3
    • “Found Text” Abstracts
    • Build Your Own Website
    • Write Your Own Text Adventure Game
    • Publish Your Own Digital Edition
    • Final Project
    • Rubrics
  • Resources
    • Readings
    • Tool Kit
    • Tutorials & Exercises
  • Reflections

How did Linn feels? Sentiment Analysis on Linn’s Journal

December 11, 2016 by Iris Fu

For the final project, Matt, Tong and I formed a group trying to do sentiment analysis on Linn’s Journal. First, we divided the whole journal into three parts, and each of us marked up the emotion in our assigned part with “positive”, “negative” and “neutral”. We used the tag “state” and “note” to denote the type of emotion like “<state type = ‘emotion’><note>positive</note></state>”. One example in context of how we marked up is shown in the highlighted part below.

 

markup

 

 

 

 

 

 

 

 

 

 

 

Figure 1. Marking up the Journal.

After marking up the journal, we need to find a way to extract all the information and visualize all those data. To do this, I wrote a python class first to read in the text from the file. Then, it’s going to find the first locator in our case is the “<date type = ‘diary’ calendar = ’0000-00-00’>” to extract date information and add to the list if it’s different from the previous one. Since some use space between words and “=” and some don’t, and some use single quotes and some use double quotes, I decided to get rid of those extra details first, therefore I wrote a static method called “findtag” which takes in a tag without the information you’re looking for and outputs a list of tagwords that later can be used as locators in the search. After searching for dates, I’m able to get a list of indices for dates in the text. Here at first I was very confused what information show I record, should it be a list of dates or a list of indices? Although I’m going to need the date information, I can get it easily by using a list comprehension later, but indices are more useful in the second step. After that, I search for the second locators which is “[‘state’, ‘type’, ‘emotion’, ‘note’]” here to get the emotion between dates. The final step for the data processing is to count the number of emotions presented for each period.

pyfile

Figure 2. Extracting Information

I think findInfo in the PTs class can be easily transformed into a tag extraction method. In my way of extracting, the sequence of tags will be preserved. To be notice, the locator has to appear in sequence to successfully locate the information. Also, we can set how many words after the locator is the information we wanted.

The final step is to visualize the information we got. To do this I used a python library called matplotlib. At first I don’t really know how to add tags to x-axis and how to annotate the graph, so I searched online and by trying I found out that I can use xticks and rotation to do what I wanted.

To be notice, there’re no journals for the date of Battle of New Bern, and he didn’t wrote any journal directly after that, so the arrow in the graph is actually pointing to a date before the battle, but in general we can see that Linn is usually in good mood before the battle, but after the battle he usually feels exhausted or just bad since he has a great responsibility on his shoulder but there’re death and injuries around him all the time.

During the final project, I think I’ve learned how to start a work. To begin with, we need to know how we want our product to be, and then we can finish it step by step. Even if there’re only three lines, we cannot plot them if our markup is not standardized. We learned how to communicate with each other and how to coordinate our times. Also, I learned how to learn new techniques by ourselves, since we were not told how should we mark up the emotion and how to annotate the graph in python. If I had more time, I might even consider trying to make my python file into a GUI interfaced information extractor. In general, I think it’s a great final project in which I’ve learned a lot from.

figure_2

Figure 3. Our Final Plot

Filed Under: Reflections Tagged With: Linn's Journal, python, visualization

The Thrill of the Heist

September 26, 2016 by Dale Hartman

The project my team and I are working on is an extension of the classic heist story, where a character must make their way through a secure facility to steal something of great value.  There is some universal appeal to a heist,  and we feel that it ties in very nicely with some of the standard ‘choose your own adventure’ cornerstones.  Specifically, we plan on tying in elements of mystery and puzzle-solving in order to make our story engaging.    Our story focuses on a recent college graduate and his two friends, who get involved with a museum heist.  One of the other graduates will serve as a kind of coordinator, and will be our tool for passing important information on to the player that their character would otherwise not know.  The other is kind of the ‘inside man,’ and will challenge our player to keep another person in mind when they are making their decisions.  Our story paths are going to branch out quite a bit, which I feel cements the validity of our story as a work of interactive fiction as defined in Literary Gaming.  The introduction stresses that interactive fiction “would lose something of its aesthetic and semiotic function if it were removed from [the digital] medium.”  We can’t reflect the branching story and puzzles we wish to create through a static medium.

 

Mystery is a challenging sensation to create in a text adventure.  We want the player to be drawn into the story, and for them to want to continue in order to reach the conclusion.  However, if we leave the player confused and unsure of what’s going on, it’ll have the opposite effect.  We can’t really use visuals or other media to get our point across.  Literary Gaming, defined literary video games as experiences where verbal components are the foreground.  One of the methods we are using to mitigate this confusion is providing distinct choices to the player every time they need to provide input.  Under the hood, every text adventure game has this going on.

A screenshot from Open Sorcery. Every bit of text in red is a button, which is the player's method of gaining information and progressing the story
A screenshot from Open Sorcery. Every bit of text in red is a button, which is the player’s method of gaining information and progressing the story

For every fork in the road, there are only so many paths you can take.  The program will only be able to understand and act upon the specific responses it’s programmers expected and coded in at that location.  We plan to turn that into an asset for the player.  By showing them those choices, we can be sure the player will not be lost simply because they can’t find the words we expected them to type in at that location.  Our group got this idea from one of the Case Studies we played: ‘Open Sorcery.’  This text adventure game took user input by turning specific words in the display text into the choices.  While playing this game, I was never lost as to what I could do, but I also never felt like I was being constrained by the choices available.

 

 

Our group is working together very well so far.  The overall idea for the story came out of the time we spent in class brainstorming.  We did a great job of building off of each other’s ideas in order to get to the semi-final story we have now.  I am the most experienced coder in the group, so my #1 focus is going to be the difficult parts of the game code.  Ella and Neil have been focused more on the writing.

A helper function to get player choices. Functions like this help keep the logic code of the game clean, and prevent retyping similar lines of code over and over.
A helper function to get player choices. Functions like this help keep the logic code of the game clean, and prevent retyping similar lines of code over and over.

However, as the project continues, we will all mix around and I predict each of us will work on all parts of the project.  As of right now, I’ve been working on a few Python functions to serve as helpers when we are writing out the full code of the story.

Filed Under: Reflection #1, Reflections Tagged With: Adventure, Crime, python, Story

Literary Gaming: Questioning Traditional Agency in Game-Play

September 20, 2016 by Maureen Maclean

My group (me, Iris Fu, and Matt Fay) is creating a superhero game in which the player can choose between three superpowers: super-strength, the power of flight, and invisibility. With the limitations of their ability, the player must navigate one of three different scenarios assigned to them by probability/chance. All three scenarios feature the player (superhero) confronting and trying to defeat a villainous force. Each scenario is written to favor one power, thus limiting success by chance and ability (superpower). Even though certain scenarios are more adventitious for a certain power, the outcome of any run of the game is not as clear as win or lose. For example, the player might be successful in saving the day but still end up in jail; life isn’t black or white, but it’s messy and gray.

The Netflix hit show Jessica Jones inspired my scenario in which the player is an investigative journalist trying to get at the bottom of a government conspiracy. Unlike a lot of superhero narratives, Jessica Jones questions traditional concepts of agency and morality. At the end of the season, viewers are not rewarded clear winners or losers and conflicts still remain at large.
The Netflix hit show Jessica Jones inspired my scenario in which the player is an investigative journalist trying to get at the bottom of a government conspiracy. Unlike a lot of superhero narratives, Jessica Jones questions traditional concepts of agency and morality. At the end of the season, viewers are not rewarded clear winners or losers and conflicts still remain at large.

In the introduction of Literary Gaming (2014), Ensslin states that literary games are “designed to make players reflect on conventional aspects of games such as fast-paced action, rule-governed kinetic behavior, goal-directedness, and simplistic friend-and-foe binary thought ”(7). Indeed, our game fits within this framework of literary gaming as our game delineates from traditional aspects of fairness. For example, many traditional games start with players on equal level fields; regardless of the race you choose in Skyrim-whether Breton or Argonian- you will get the same quests. In our game, however, players are assigned scenarios that are easier or harder depending on their power. Even beyond the realms of game or narrative, our game asks players to question their experience of life in terms of the choices awarded to them by chance and/or ability. How does privilege affect your circumstance? What abilities or lack thereof affect what you can do or accomplish? How much “luck” do you reward to your current situation in life?

Like many literary games or really games in general, our game is a collaborative effort. Using Rettberg’s definition, each team member is a conscious participator- we all know the restraints, nature, and our role in the project (137). For instance, each of us is writing one scenario that favors one superpower: Iris is doing super-strength, Matt is doing flying, and I am doing invisibility. Even though we each write a scenario, we have to be mindful to balance our stories in terms of length and difficulty with each other’s. Additionally, we have to be mindful not to make our scenarios to similar to each other. One challenge or difficulty of working in a group of three is that we can’t read each other’s minds; we have to continually communicate about how our scenario is evolving. Also, in terms of the division of labor, our method (we all write and code) is inefficient. It delineates from traditional group work that assigns a role to one person, such as one person coding and another writing the story. On the other hand, our method offers a greater variety of game-play and lets each of us participate in storytelling process. If I were to create the game alone, I would not have the time to create 3 scenarios much less have the creativity to ensure that they each represent different points of view.

My narrative outline of the game. WARNING: contains spoilers.

Filed Under: Reflection #1, Reflections Tagged With: agency, choice, DH, Game, Iris Fu, Matt Fay, maureen, python, reflection, super powers

HUMN 271

Bertrand 012
TR 9:30-11:20am
Dr. Diane Jakacki

Authors

  • Dale Hartman RSS feed
  • Diane Jakacki RSS feed
  • ejp013 RSS feed
  • Ella Ekstrom RSS feed
  • jaa023 RSS feed
  • Jingya Wu RSS feed
  • Julia Wigginton RSS feed
  • Matthew Fay RSS feed
  • Matthew Lucas RSS feed
  • Neil Lin RSS feed
  • Peter Onusconich RSS feed
  • Sarah Rosecky RSS feed
  • Tong Tong RSS feed
  • Xing Fu RSS feed
  • Yash Mittal RSS feed

Creative Commons License

Creative Commons License Bucknell University Humanities 271 Course by Diane Jakacki is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Copyright © 2023 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in