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

Linns’ Letter

November 17, 2016 by Iris Fu

The first part of this module is to decode Linns’ manuscript. Our group started with a very long James’ letter. In China when teaching English, we learned only Italic in class. Although personally I know some cursive, it’s still very difficult to recognize those words. For example, it’s very difficult to distinguish ‘c’, ‘u’, ‘v’, ‘e’ and ‘o’. It’s hard to tell between ‘b’ and ‘lc’ as well. Sometimes we need to combine with the context to guess what he was writing about. For the later individual part, I got a mostly transcribed letter from James’ brother John to James. Even if I was given the mostly transcribed version, I have no idea why the word is transcribed as such. It will be really interesting to sit in a library and spend all day just try to decode the letter for myself, but as an assignment it becomes a frustrating experience. I tried to get some idea from his other manuscripts, but it didn’t help much.

dsc_00071

I love the archive experience. On screen the letter has a pale background, but when I actually looking to the piece in the archive, it’s different. It’s written on a brown/wooden piece of letter paper with lines on it. It was like my answer sheet in high school. Although I cannot fully recognize his hand writing, it’s really beautiful maybe even as an art piece. You can feel the history through the steins and the color of the paper. I think it’s easier to read for me. On the computer screen I always try to magnify the word a little bit more to try to recognized the word, but it’s not helping. In the archive I was even able to recognize a word that I had no idea before. This might be because I was reading the letter as people at that time did, which gives me a sense of the bigger picture of the letter. With a vertical screen, it’s hard to tell which part I was working on, but I can work with the digital version anytime I want though. The more I want to focus, the less information I get.

img0001-160002

Since my part of the letter is John’s letter to James, the content is not related to what James wrote in his diary. However, when I was trying to write diaries in elementary school, I would elaborate on who is present, what time the thing is happening and what has happened since diaries are for teachers to read.   If the diary is for my own, I would write things less detailed but write more about my feelings at that time. James used a lot of “we” without directly pointing out who the persons are and didn’t say much about his own feeling (it’s like I can’t feel his emotion from his words) but more about what has happened may suggest the audience of this diary might not be his future self.

For me, I’ve never heard about Linn before this mark up, and knew very little about American history.  Doing those markups and transcriptions makes me feel like I was part of it, like his family or acquaintance from Lewisburg was reading the letter he wrote from the front line.

Filed Under: Reflection #3, Reflections Tagged With: James, John, Linn, markup

First Encounter with TEI

October 31, 2016 by Iris Fu

I have never been worked with a language like TEI. In my mind, computer science languages like Python and Javascript are objective. If I want to achieve a certain functionality, I use specific grammars to do it, and the boundaries for different grammars like list and dictionary are really clear. However, for me TEI is kind of a confusing language. First I need to read the whole document, and then mark up any important elements by using different tags.

Since don’t have background with TEI, I used the TEI website a lot to make sure that I used appropriate tags when marking up both of the text. Even I tried to mark up as accurately as possible, there’re still some places I don’t know which tag to use and thus I chose the tag I think is the most appropriate. This could be potentially problematic, since like in Python, I’m able to test whether I used the correct thing or not, but in TEI as long as it’s a green box in the upper right corner, I have no further information. In the Poe text, first I marked up all the diplomatic elements using for example, <emph></emph> to show author’s emphasis on words here “__word__”. Then I marked up other elements like using <persName><persName> for a person’s name. At first this was very hard for me, since basically have no understanding about what tag should I use, so for a person’s name, I used <name type = ‘person’></name> at first. The only information I can get for TEI is basically from its website, which has some examples for each tag, but the explanation is not really detailed. Therefore I thought <name type=’person’> is appropriate here. However, after I’ve asked the difference between those two tags in class, I realized that “name” here is like a assigned tag not like the real person’s “name” we usually used in our daily life, so I had to change all my markups. For the Declaration of Independence the mark up process is different. Basically I was researching about a signer Samuel Chase on Wikipedia, and add the relevant information to the template. I think this is much easier since all the tags are provided so that I don’t have to consider that much about which tag to use as for Poe.

poe

Figure 1. Mark up for Declaration of Independence

doi

Figure 2. Mark up for Poe

I do believe that my searching for the appropriate tag to use on TEI website familiarizes me with TEI and helps me to better understand the subject matter. In this process, I become a co-worker of the text according to Rasmussen. “The co-worker seeks to go beyond the user and reader roles, and to contribute actively to the scholarly enterprise. This could consist of making annotations, reading proofs, adding encodings, or contributing in other ways to the site’s total production of knowledge.” During the close reading and encoding process, I made notes, did extra research and annotates the text based on my understanding, which will definitely help me to understand the subject matter. The intended target for the Poe text should be general readers, but it’s used scholarly as we were marking up the text. When creating the digital edition, the editors must have noticed and made their editorial choice to keep a limited number of elements. This might let us not able to understand and decode all text correctly, but it’s unavoidable like mentioned in the Pierazzo. “Digital editors must consider the needs of the users when preparing their publication and, in consequence, considerations about what kind of users to expect and how to meet their needs have become a common concern for any kind of digital publication.”

Filed Under: Reflection #2, Reflections Tagged With: Declaration of Independence, markup, poe

Weekend_is_for_Gaming.py

September 20, 2016 by Iris Fu

Superheros

Superheros

We, Matt, Maureen and Iris are from Group 3, and our project is a story about superheros. More accurately, the player will first choose their superpower from invisibility, super-strength and flying, and then randomly assigned to one of the three scenarios and trying to save the people as superheros always do. The objective of this game for the player is successfully stops the crime and save all the people and get to an happy ending. However, unlike in movies, superhero doesn’t always success even if they chose all “correct” answers. We’ll set the possibilities and the computer will decide the ending of the story. In my scenario, the player will control the trend of the story by making subtle personal choices but the ultimate challenge will be a moral question that has no right or wrong answer to it. My scenario will be in second person narrative which can furthermore make the player feels and acts in their role as a superhero.

Our work will be presented with a digital form. Like mentioned in the introduction of Literary Gaming: “With a new generation of cross-media writers emerging on the horizon, a greater variety of explorative texts will become available. ” Our game relies on algorithms that enables the player to interact with the text. Their decisions will affect the ending of the game. Such interactions might be hard to present without the help of modern computer science technology. However, our works are subject to constraints as well. We need to set a bunch of rules based on our discussions and write the scenarios accordingly. For example, we even set how many options will we give the player each time. Although our scenarios are not written collaboratively, but for the good of the project we worked like The Unknown mentioned in Rettburg which is built upon respect.

The benefit of team working is that we can divide the work up and thus each of us don’t have to write as much as we have to when working individually. For example, each of us only have one scenario to write but when adding up in total we have three different scenarios. Also different scenarios that has different perspective in them will make the game more playful. However, since we need to write the algorithm to achieve the functionalities and to present the texts as an interactive game,  we need to work collaboratively and determine the trend of the stories in advance. If we didn’t agree and shared how we’re going to write our scenarios, it might cause difficulties when writing the computer program later on. Also, each one of us has different schedules so finding a commonly available time to meet might become a challenge. I assume later on coding might be a real challenge. In my experience combining individuals code might cause a great problem of what should a function takes in and what should comes out. If this cannot be handled properly, the program will not run and we’ll spend lots of time changing what we’ve coded.

screen-shot

We’re thinking about finish writing the scenarios before this Tuesday and starts the coding part later this week.

Filed Under: Reflection #1, Reflections Tagged With: gaming

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