Analyzing My Digital Footprint—>Tak

footprint-blog

 

The above in an analysis of my current thesis proposal. This summary is a requirement for all 2nd year students in their thesis process. From which a thumbs up or down is given to proceed. I thought this was an interesting body of text to analysis due to the thorough consideration of each word and conciseness of the idea.
The resulting visualization from the processing sketch uses HashMaps to store each word, count the frequency and analysis its length within this body of text. The smaller red number represents the frequencies of each word. Along with the number indication this sketch uses HSB color mode to help distinguish ‘prominent’ words. Hue shifts from light yellow to blue depending on the particular word’s length. Saturation is also calibrated by 1/2 of length, and brightness is mapped to frequency of word use.

So a really quick analysis I can draw from this is, maybe, we can shorted the ‘elevator pitch’ to 1 second soundbite. Seeing this result I wound pick the longest, most infrequent word -with- the shortest, brightest word. I would end up with “Omni-experience Food” as my soundbite. And that’s a delicious soundbite!

Code Below, you’ll need to save your own text file.
(p.s. this is really messy code with little comments… sorry, just had to get it done…)


/*
Computer for the Rest of You (class)
with Dan O'Sullivan
Feb 26, 2013
by Tak Cheung

#4 The Rest of Your Digital Self
looking at unique words in public posts

*/

import toxi.color.*;
import toxi.util.datatypes.*;

int widthRatio = 8;
int heightRatio = 11;
int zoom = 80;
int border = (widthRatio*zoom)/12;
int fontSpace = 8;
float fontHeight = .35*zoom;
float fontSize = .20*zoom;

HashMap allWordCount = new HashMap();

String[] rawText;
String[] eachWord;

PFont font;

void setup()
{
size(widthRatio*zoom, heightRatio*zoom);
colorMode(HSB, 1, 1, 1);
font = loadFont("Helvetica-24.vlw");
rawText = loadStrings("thesisDescription.txt");

allWordCount.put("one", 1);

for (int i=0; i<rawText.length; i++)
{
eachWord = split(rawText[i], ' ');
for (int j=0; j<eachWord.length; j++)
{
String w = eachWord[j];
//w = w.toLowerCase();
w = w.replaceAll("\\,", "");
w = w.replaceAll("\\.", "");
w = w.replaceAll("\\/", "");
w = w.replaceAll("\\'", "");
w = w.replaceAll("\\:", "");
w = w.replaceAll("\\)", "");
w = w.replaceAll("\\(", "");
w = w.replaceAll("\"", "");
w = trim(w);

if (allWordCount.containsKey(w) == false)
{
allWordCount.put(w, 1);
}
else
{
Integer n = (Integer)allWordCount.get(w);
int count = (n!=null ? n.intValue()+1 : 1);
allWordCount.put(w, new Integer(count));
}
}
}

Iterator iter = allWordCount.entrySet().iterator();
while (iter.hasNext ())
{
Map.Entry me = (Map.Entry)iter.next();
print(me.getKey() + " *IS* ");
println(me.getValue());
}
}

void draw()
{
background(0, 0, 0);
smooth();

int n = floor(map(mouseX, 0, width, 0, 8));
//println(rawThesisDescription[n]);

float totalTextWidth = 0;
float totalTextHeight = 0;

translate (border, border*2);

for (int i=0; i<rawText.length; i++)
{
eachWord = split(rawText[i], ' ');
for (int j=0; j<eachWord.length; j++)
{
String w = eachWord[j];
w = trim(w);
Integer nW = (Integer)allWordCount.get(w);
if (nW == null) {
nW=1;
}

float mW = map(nW, 0, 19, .90, .25);
textSize(fontSize);

float currentWidth= textWidth(w);
float hueColor = map(currentWidth, 20, 106, .05, .55);//= width-border*2)
{
totalTextWidth = 0;
totalTextHeight += fontHeight;
}

// if (w == "\r") {
// println("hello----------------------------");
// }

text(w, totalTextWidth, totalTextHeight);
totalTextWidth = totalTextWidth+currentWidth+fontSpace;
//println(currentWidth);
textSize(fontSize*0.5);
fill(0.1, .9, .7);
text(nW, totalTextWidth - 9, totalTextHeight - 13);
}
}
}

Comments are closed.