Shape of Words
Intro:
After seeing The Art of Pi by Nadieh Bremer I was inspired to use her random-walk style technique to interrogate the shape of other things. Pretty much every irrational number has already been visualized so I figured why not move out of the math domain and into something more… personal.
Many efforts have been made to look into the “shape” of stories (see this post for my take on it,) but not much attention has been paid to a smaller scale. By converting a word or small sentence to a series of numbers and then generating a walk based upon those numbers we are able to construct a kind of fingerprint for any given set of characters. Keep in mind this fingerprint means absolutely nothing and is arbitrary in the most pure sense of the word, but it is interesting none-the-less.
The plotting and walk code is almost unabashedly wholesale taken from Nadieh Bremer’s github repo for her project. If you haven’t checked out her site/work I highly recommend it!
Converting a string to numbers:
We will take a string and split it on each letter. From here we will assign a number from 1-26 to each letter corresponding to their position in the alphabet. E.g. a = 1, b = 2, etc. We allow a space to equal 27.
Awesome, now that we have that we just need a way to translate these numbers into a random-walk style coordinate list. We need to scale the domain of to the range so that we can multiply by and get a radian corresponding to some angle around a circle.
val | x | y |
---|---|---|
8 | 0.0000000 | 0.0000000 |
5 | 0.9182161 | 0.3960798 |
12 | 1.2602363 | -0.5436129 |
12 | 1.6022564 | -1.4833055 |
15 | 1.2602363 | -2.4229981 |
0 | 1.2602363 | -1.4229981 |
27 | 1.2602363 | -0.4229981 |
23 | 0.4581131 | 0.1741605 |
15 | 0.1160929 | -0.7655321 |
18 | -0.7499325 | -1.2655321 |
12 | -0.4079123 | -2.2052247 |
4 | 0.3942108 | -1.6080662 |
Now make a plot function to draw the “random” walk.