Notestream: Useful nodeJS Modules

My thesis project Notestream was built on top of nodeJS and Express. What has really sold me on nodeJS is the active community and the amount of modules available for use.

Here are a few modules I found useful during Notestream's development.

Shred

Shred is an HTTP client library. I used the Shred module for AJAX posts when I wanted to append more meta data, but didn't want to slow down the user from advancing to the next page.

For example, Notestream users save a Vimeo video to their video collection in order to mark it up with annotations. After a user submits the 'save video' form, Shred allows the server to gather additional meta-data from Vimeo after the AJAX post is made. It's all happening in the background.

JSON2csv

Another useful module is JSON2csv, and title pretty much says it all. Notestream users can download their notes in csv format thanks to JSON2csv. The module pings the Notestream API when a user chooses to download their notes, and formats the JSON accordingly.

Tock

Tock is Javascript countdown clock and timer. Why use this when JS already offers interval and timeout function? Because they're not very accurate. What's awesome about Tock is it self-corrects the time based on the system clock, so it won't lose track of the time.

Open Science Wireframes

Small Is Beautiful is a 2-credit course geared towards building a citizen cyberscience project focused on nanotechnology. Citizen cyberscience refers to bringing the general public onboard a science project through the use of readily-available technology.

My partner, Robin Reid, and myself worked with Montclare Labs to conceptualize a project for crowd-sourcing data on proteins being assembled in their lab. Montclare Labs is researching proteins for cancerous cells.

Read More

Python Haiku Generator

In the same vain as my poem generator, I have coded a haiku generator in Python. Initially I wanted to write a haiku generator before resorting to a poem generator, but I could not find a source for the number of syllables for a dictionary of words.

Well, that problem is solved — Carnagie Mellon offers a pronunciation dictionary, for their speech-to-text engine, Sphinx. The dictionary is open-source, so I am using it as a source for words and syllables for the haiku generator.

Haikus are traditionally three lines, with a 5-7-5 split, or five syllables for the first line, seven syllables for the second, and again five syllables for the final line. If your middle school days of English class are beyond your recollection, it looks something like this:

An old silent pond...

A frog jumps into the pond,

splash! Silence again.

The CMU dictionary is simply a text file with each word split into the following format:

AGENCY  EY1 JH AH0 N S IY0

The line starts with the word, then two whitespaces and the pronunciation with numbers indicating the syllable breaks.

I wrote a function to break these lines down into a word and a syllable count, which is then stored in a Python dictionary. The dictionary is set up with the syllable count as the key, and the list of words with associated syllable count as the values.

The final part the code then builds lines depending on the amount of syllables desired, which is then constructed in a final function in a haiku format. Here is a sample of outputs:

MUSTAFA WILSON'S

WONDERFULNESS JAWED BARBY

WORLDERS BAS-RELIEF


BATTERERS FOOTLIGHTS

STRIKE KONARSKI HARDYMON

CHOO STRANDS SOLIDLY


SPATH RASH SPIKE MUCUS

UNDERLINING SCREWDRIVERS

STOUT SEALED VOS HANZLIK


Check out the code here.

Python Poem Generator

Our Reading and Writing Electronic Text Midterm projects consists of two steps:

  • Devise a new poetic form.
  • Create a computer program that generates texts that conform to new poetic form you devised.

Initially I wanted to create a haiku generator. Unfortunately there are not a lot of online resources dedicated to breaking english words down by syllable. Instead, I settled on a poem generator.

The python script scrapes a random word generator at Vocubula.com, where it gets the word and the word's part of speech. From there I organize the words according to parts of speech inside a dictionary, where the part of speech is the key, and the values are lists filled with the words.

I also scraped a list of prepositions to insert into the poem structure.

The poem structure itself is four lines, and each line is a simple sentence structure.

The poem generator has created works such as:

cacography popple incunabulum through the exuviae
nympholepsy versus ensorcell skeuomorph
inhere subfusc triumphalism
cosmography disabuse by means of gourmand

Or:

detritus perambulate bacronym against the caducity
Weltschmerz in front of enucleate suborner
notional soi-disant succedaneum
zoophyte embay modulo gourmandise

And finally:

quatopygia straiten menology neath the anonym
incubus left of transude quiddity
perambulate chthonic juvenilia
maenad ameliorate above zenana

The output reads like a Harry Potter spell. While it's not very impressive, perhaps there are more variations in the line structure to investigate.

The code is available here: Github.