Poem as value
Clojure/West 2014
"Crazy Clojure" track
"Crazy Clojure" track
facjure
Rationale
Build organic software.
“Do anything, but let it produce joy.”
The Real Problem
curate poetry from the public domain
Books are pages
clauses, phrases, sentences
similies and metaphors
They're not Strings.
source: new yorker
We can't interact with a book
or poems on a site.
I used to be a Java certified programmer, who knew design patterns, scripting languages, etc.,
Then I started learning Clojure
Every good poem asks a question, and every good poet asks a question.
- Dorianne Laux
poetroid
how do you discover poetry together?
Start with the Page.
No cms, no frameworks, no mvc
no buttons, no menus, no forms
Just the Page and the Poem.
DEMO
curate, search, record & play
a browser repl for
poets
Design is inspired by IAWriter
Search
word counts
note
note 2 1 2 5
note with comments
note 4 11 4 14 "note the sounds of words"
linguistics for humans
nouns, verbs, etc.,
hyphenate
hyphenate
animation
anim
+ custom typography (based on metadata)
realtime search ...
together
Inspired by ...
Lighttable
How do you contextualize a runtime engine with near infinite customizations?
Think in data
build a foundation on data
make a platform
to adapt and grow
in ways you couldn't have thought of in the beginning.
DAtomic
How do you record memories?
Store a collection of facts
that do not change, add new facts
like memory
superseding old facts over time.
Build snapshots of facts
that collect knowledge
over time
to reveal meaning.
Om
How do you re-render thousands of ui components with record and play?
om
record interactions in dom
with atoms for edn
for local and shared states
create cursors, with live path-refs
view-datas pointing to application state
view-datas pointing to application state
follow protocols
and optionally, sync them with server for playback.
Architecture
If you were to choose between being eclectic and various or being repetitious and boring, be repetitious and boring. Most good poets are, if read very long at one sitting.
Richard Hugo
History
attempts at refactoring the same idea
v1 - python/flask app
v2 - node/express app
v3 - python/sammyjs static site generator
six months later ...
Poem
in plaintext
---
title: You May Forget
author: Sappho
country: Greece
year: 600/500 bc
gender: female
tags:
- time
- love
- lyric
- memory
---
You may forget but
let me tell you
this: someone in
some future time
will think of us.
poem
in edn
{
:title "You May Forget"
:author "Sappho"
:country "Greece"
:year "600/500 bc"
:gender "female"
:content #zen/content
"
You may forget but
let me tell you
this: someone in
some future time
will think of us.
"
:tags #{:time :love :lyric :memory}
:collections #zen/collections
{:name "my favorite greek poems"
:public true}
:annotations #zen/annotations
[
{:selections [[1 1] [1 3]]
:type :notes
:notes #zen/note "Unusual opening line."}
{:selections [[3 2] [5 4]]
:type :highlight
:highlight #zen/highlight #{:quote :bookmark}}]
}
Annotations
commands in repl
Poems are internally stored as data structures with:
tokenization and frequency counting.
Annotations are interactive commands (s-expression) with english-like words, applied on poem's data (Edn).
Commands are dispatched via core.async
and sent to server by jQuery.
Lessons learned
Custom Repls eliminate complex menu/navigation/forms.
Immutable data structures make dom manipulation easy.
Lighttable changed the way we approached web development.
Splitting Content & Data with Elasticsearch/Datomic has worked well, so far, separating concerns.
With Edn as a common denominator, future content types are possible.
struggles
New to Clojure, Clojurescript, core.async ...
Error handling
Best practices
Devops
Responsive HTML5 Layouts with Om
Poem as value
nuts & bolts
Content: Plaintext (Zenup)
Data: Edn
User Annotations & Interactions: Edn
Design: HTML5/CSS3/JQuery*
*static assets in cdn
Api
Huge fan of Python for Humans
Api
edn
(zen/read-zenup :resource "data/poem.txt")
(zen/read-edn :file "~/my-poems/whitman-leaves-of-grass.edn")
API
elastic search
(def whitman-100 "/Users/priyatam/poems/*.txt")
(search/setup)
(search/index :resource "data/poem.txt")
(search/index-all atas-curated-2k)
(first (search/meta-query :title "In Silent"))
(search/meta-query :content "someone in")
API
datomic
(data/connect! :mem "poetroid")
(data/load-schema "data/schema.edn")
(data/save-poem :s3 (:my-poetry-bucket env) "thinking-in-clojure.edn")
(data/save-poem :resource "data/poem.edn")
(data/find-by :author/fullname "Sappho")
(data/find-by :poem/short-url "host-url/21618f18")
(def ann {:annotations #zen/annotations
[{:selections [[1 1] [1 3]]
:type :notes
:notes #zen/note "Unusual opening line."}]}
(data/save-annotation ann "21618f18")
API
python linguistics
hyphenate(text_poem) stresses(syllable_counts) parts_of_speech(poem) parts_of_speech_tags(poem) emotions(poem)
...
Api
publish
(api/publish! :resource "data/poem.edn")
(api/publish-all! :dir "~/poems/basho-*.txt")
taxonomy
:tags
:place :time :mood
:type
:type
place
Continent, Country, Town
time
classic (1200bc-455ce)
medieval (500-1500)
renaissance (1500-1700)
enlightenment (1700-1800)
romantic (1798-1870)
victorian (1837-1901)
transcendental (1830-1860)
existentialism (1850-today)
realism (1820-1920)
naturalism (1870-1920)
modern (1910-1965)
post-modern (1965-today)
Mood
introspective
celebratory
philosophical
loneliness, death, mourning, orphanhood
conversational
subversive
type
lyric
narrative
descriptive
more
ways to classify stanzas
couplet (two lines)
tercet (three lines)
quatrain (four lines)
cinquain (five lines)
sestet (six lines)
septet (seven lines)
octave (eight lines)
what about
machine learning?
They don't carry taste.
They don't communicate.
Poets do.
Once language exists only to convey information
it is dying.
- Richard Hugo
(map meaning context values time)
Assumptions
a boy
a field
a soaring eagle (off screen)
a boy in search of father
(all of the above)
conflict
#{:context :values :time}
Context
{{.}}
{:context #{:boston-commons :bd-colen-photography-workshop "a few hours after shooting the following photos"}
:time "4th July 2011"
:photo-log "www.site/son-alone.jpg"
"www.site/son-father-together-08.jpg" "www.site/son-father-together-07.jpg"}
meaning
We don't erase our old memories in order to form new ones. It's likely we will look back at the last few decades as an unfortunate time when computers kept us from doing the right thing.
The time to change that is now.
- Datomic docs
*edited for brevity
Roadmap
Compose pages
public and private schools in US 143,671
poets & writers graduating every year 2,030
literary magazines 600
team
founder/principal, writer, programmer | facjure | @priyatam
Sreeharsha Mudivarti
programmer, musician @sreeharsha_mud
Ata Moharreri
consulting poet, professor @AtaMoharreri
currently in pre-alpha
References
Resources for poets Poets & Writers .org
Rethinking the Masters in English for a new century | ADE adhoc committee 2011
presentations, Essays
we love
Credits
Opensource
Om by david nolen lighttable by chris granger | the incredible jquery elasticsearch & clojure communities
grid.css by adam kaplan | blacktie.io | reveal.js by hakim | brick fonts by alfred xing | flowtype
grid.css by adam kaplan | blacktie.io | reveal.js by hakim | brick fonts by alfred xing | flowtype
Errata/Change History:
3/26/14 - fixed typos, removed first/last page, added "struggles", refs, missing credits, and high-res demo snapshots
3/25/14 - demo at clojure/west
Poem As Value
By Priyatam Mudivarti
Poem As Value
A functional concept for interacting with poems from the public domain: encode poems in Edn, explore them with Elasticsearch, study Linguistics, and save annotations as immutable data structures. Written in Clojure Python Clojurescript jQuery and CSS3. Presented in the track, "Crazy Clojure" http://www.youtube.com/watch?v=78akckfpvnQ
- 1,922