Selling to girls

Mar 20 2012

This is a story of three guys writing a business plan for a class at college. A business that rakes in 500,000 euro in sales after three years, with 30k of pure profits to boot.

Rope

Rope (Photo credit: jacobC)

It’s not a swing for the fences kind of story, but taking three years to set up three 20-somethings and their families for relatively comfortable lives is nothing to scoff at!

I first heard the story last Friday, at a mandatory entrepreneurship class. It’s a story of three of the professor’s former students, told as an example of a business plan gone good. As part of the class we are divided into groups and asked to write a business plan over the semester.

The Story

Student A was a very passionate alpinist. His business idea was making climbing rope so he pretty much forced the rest of the group to go along with the idea. The professor found the idea somewhat odd, but hey, it’s just a class assignment so why not.

After some passionate explaining – the rope needs to be elastic so it catches falling alpinists softly. But not too stretchy or it will become a bungee cord and people will die. The same elastic properties must hold at -70C and +40C. The rope mustn’t frail when being dragged through rocks and bushes. Or people die.

A 60 to 70 meter stretch of rope costs 200 euro. (one unit)

Suddenly “climbing rope” doesn’t look like a silly problem. Now, what’s the market?

The guys did their market research. Googled everything, posted extensive questionaires to climbing forums and found out that the average US alpinist buys new rope every year, the average European every 2 years and the average Slovenian every 3 to 4 years.

Freshly cut and bound end of 10.7mm dynamic ke...

Complex rope. (Photo credit: Wikipedia)

The average Slovenian also gets 110 climbing days a year, which makes us crazy, since rope after one “full load” becomes unsafe.

Only five companies in the world make this sort of rope.

Most of them also dealing with other climbing gear. Only a single Czech company deals exclusively with rope – they do about 5,000,000 euro in sales a year. The market looks pretty crowded when only 5 companies share the lot, especially since alpinists buy almost exclusively from established brands.

Not one to back down from a challenge, they called the Czech company: “Hiiii, I’m a harmless student from Slovenia, working on a school project … blahblahblah”

They got through to an engineer and got him talking about rope. Turns out the whole market is worth 25 to 30 million a year.

Student: “So only hardcore alpinists buy this rope huh?”

Czech engineer: “Oh haha, heavens no. Most of it goes to indoor sports climbers who rarely leave the arena”

At this point in the story, everyone started getting bright ideas. They could make the rope cheaper! Doesn’t need to be as rock resistant! Hey, they don’t have temperature swings! They can make it lighter! Cheaper too!

But what’s to stop everyone else from releasing rope for indoor use only? Here you are, fresh into the rope making business and everyone else with a bunch of experience … no that’s not going to work. You also wouldn’t want to compete on price since that’s always doomed to fail.

Well, what if I told you most indoor climbers are girls? That they buy rope like crazy (a lot of falls) and absolutely never leave the arena?

Now the class was stumped. What the hell kind of information is this? There’s nothing we can do! Just make it lighter or something, girls hate carrying heavy things …

PINK!

Make the rope pink and voila, a whole market of indoor female climbers scrambling over each other to buy your rope because it’s prettier.

Even better, these guys are now buying rope from the Czech manufacturer, dying it pink (or whatever the colour of the season is) and marketing it to climbing girls the world over.

Nobody else is going to move in on their market because it’s too sissy. A real man’s climbing gear manufacturer can’t afford to be associated with a sissy product. Just like you and I, they scoff at the idea of “Pfah, pink rope. Don’t make me laugh. As if colour’s got anything to do with anything. That’s not even a real value proposition!”

Here’s the real kicker, when I told this story to my sister or any of my female friends, the idea of “Yeah, just make it pink, right?” came up the moment I mentioned indoor climbers.

PS: my sister keeps complaining that running shoes for real athletes are all ugly. So do all her friends. Anyone wanna do something about it?

Enhanced by Zemanta

8 responses so far

Django and IE9 don’t play well together

Mar 19 2012

You know those bugs that take hours to debug? And the fix is … moving a single line.

filming of the HTML music video

filming of the HTML music video (Photo credit: MadLabUK)

That kind of bug is tripped up when you use django’s csrf protection and someone comes to your site using IE9. It can easily happen that not only will form stylings not affect the elements, the form might even ignore any values entered!

But it works perfectly on older versions of IE.

The bug was insanely difficult to pinpoint because I don’t have IE9 anywhere – only linux and mac around here, any windows box is so old IE7 is about the extent of its capabilities … After installing some sort of windows 7 to a virtual machine and getting IE9 working, I set to work.

Symptoms

  1. Form works perfectly in IE7, Chrome, Firefox etc.
  2. Form works perfectly with compatibility mode turned on
  3. Form values aren’t submitted
  4. Form elements don’t respond to form styling

For some reason IE9 thinks the form is empty. Displays all elements, but they don’t behave like they’re part of the form … which is kind of odd. They aren’t even selectable through the javascript console or anything.

Solution

After many pointless wanderings and random code changes, I realized the HTMLdoesn’t look like something I’d usually write (legacy-ish code).

<form action="/somewhere" method="POST">
{% csrf_token %} 
<label>blah</label><input type="text" name="blah" /> 
<!-- etc -->
</form>

Usually I’d put the {% csrf_token %} at the end. Not sure why, just the way I’ve always done it … surely this can’t make a difference right?

It can!

Putting it at the bottom of the form fixed all bugs. Styling suddenly worked, form was submitted with all data and everything worked everywhere.

Le huh?

filming of the HTML music video

filming of the HTML music video (Photo credit: MadLabUK)

When the form is rendered that  {% csrf_token %} is replaced with an invisible div tag. For some reason this ticks off IE9′s strictness and the rest of the form isn’t considered to be a part of this element anymore.

Something like this:

<form method="POST" class="filter" style="display: none">
    <div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='41aeb46067bf9e800f9ce6c718265121' /></div>
    <input type="hidden" name="selected" value="" />
    <label for="dateFrom">From date:</label>
    <input type="text" class="datepicker" name="dateFrom" readonly="readonly" value=""/>
    <!-- etc. -->
</form>

I can’t find official reference either way, but I think div’s inside forms are legal HTML, perhaps not the best looking HTML, but p tags are allowed, even happen in the form tag example on w3.org, so I have no idea why IE9 would trip up on this.

Perhaps someone a bit more knowledgeable of strict HTML can shed some light on this issue? For now, let’s all just be aware of this little quirk.

Enhanced by Zemanta

4 responses so far

Planica up close

Mar 17 2012

Wake up! Wake up, we’re gonna be late!

Planica

Planica

5am.

Took my sister to Planica to watch a bunch of flying squirrel men throw themselves off a big hill with long sticks attached to their feet to see who can go the farthest. All the while suffering a bunch of loud drunkish people.

At least that’s what I thought … but all in all it was actually pretty damn awesome!

The two free tickets didn’t just get us in the event place, after some careful maneuvering by The Ticket Guy we also got into the VIP section, right under the landing spot, with a good view of the whole flight.

Then the VIP section turned into the VIP seats, the ones closest to all the action.

Then it became a trip up the hill to see everything very up close.

Even the judge’s house thingy.

I will never forget the eery calm of standing right next to the slope and having a guy fall past you, into nothing, seemingly laying on air. Subtle whoosh sound. Amazing.

And the speed on the take off ramp! Wow! TV doesn’t do it justice at all. Yeah, sure, he’s doing 104km/h, so what? But when you’re standing 10 meters away … damn. Those guys are wearing underpants with a lot more room than mine have …

Seeing Robert Kranjec jump a 231m was … impressive. The landing looks much harder in real life than it does on the telly.

Alas, the iPhone camera was too slow to catch anyone in the air.

Looking up from down below

Looking up from down below

A bad crowd shot

A bad crowd shot

There was a guy in a full deer suit

There was a guy in a full deer suit

Plenty of balloons behind the VIP area

Plenty of balloons behind the VIP area

Ski lifts are weird without snow

Ski lifts are weird without snow

Planica's baby sibling

Planica's baby sibling

The crowd below

The crowd below

Whoosh, gone

Whoosh, gone

Best seats?

Best seats?

Enhanced by Zemanta

Comments Off

For better productivity, I watch 6 hours of TV a week

Mar 15 2012

Television is a waste of time, they say, nothing good can come of it and it’s a horrible form of media consumption.

Wandering locomotive

Wandering locomotive

With all the Big Brothers and Celebrity Top Models and Kim Kardashians out there … who could blame them? Television really does seem like a colossal waste of time. Combine that with all the commercial breaks and forced broadcasting schedules and I wouldn’t be surprised if everyone cancels their subscription.

Hell, I’d cancel my TV subscription too, if it wasn’t bundled with the internet.

When I say I watch television, what I really mean is that I steal download the few shows I like watching every week and watch them under my own temporal rules. (House MD, Top Gear, Walking Dead, Castle, How I Met Your Mother, Futurama …)

But you’re a busy guy, you freelance and blog and boxing practice and schoolwork and classes and you’re on twitter and github and everywhere. How can you watch television!?

I can do all that because I watch television.

Ever notice how your best ideas come on the crapper? Or in the shower? Or when taking a relaxed walk?

Ever seen how House solves all his cases? Or Sherlock Holmes? Pretty much anyone in any fiction ever that solves anything difficult?

Noticed how Einstein was working as a patent clerk when coming up with general relativity? Or the fact that Stephen King takes a walk every day (says so in a short stub biography attached to every recent-ish book, called “With a new preface by the author”)

Brain wandering

You must let your brain wander!

Aimlessly, without purpose, without even expecting a result. You must take the time out of your busy day to just let your brain wander without focusing on anything in particular and I promise you, great things will happen.

Creativity is born out of random connections between different ideas. But you can’t have random ideas if you never leave your brain alone. If you keep focusing you’ll never find the solution staring at you from behind the hill.

This problem is so well known machine learning and artificial intelligence have developed a bunch of tactics to combat it – everything from simulated annealing to evolutionary approaches and often just simply adding a bunch of noise to the belief state.

For me, the best brain wandering comes from watching television.

Doing sports is great to relax your brain, but is also too involved for any deep thought. Reading books, great relaxation, but it pulls you in too much and you forget about everything else.

TV, however, TV is just perfect. The stories are nice and predictable, no need to think, all the characters are always the same, most of your brain can be left to just passively take in images, while your imagination solves whatever problems have accumulated.

It’s a bit like dreaming really. A semi-vegetative state in which the brain has time to calmly digest.

Enhanced by Zemanta

4 responses so far

Closure and currying magic for cleaner javascript

Mar 14 2012

Sometimes you find a piece of javascript, a perfect piece of javascript, it does exactly what you need! Perfect! You could spend hours, even days, getting something to work and someone’s already done it, shared the code on the internets even!

Hooray!

But … the code looks something like this:

// to populate later
var data = [], oldData = [], semiOldData = [];
var a_switch = "blah";
 
function do_something() {
   // use subset of globals
}
 
function something_else() {
   // use some other globals
}
 
// etc.
 
function update() {
  // use all of the above
}

The code works … if you only need to use it once. What if you need two independent widgets? Well, you could take the time to recode all of that so it becomes purely functional.

But that’s going to be a problem – the code heavily relies on state. Ok maybe object oriented? Object oriented kind of sucks in javascript and you’d have to recode all of that, have to perfectly understand it etc.

Pain in the arse!

Closure magic

There’s a better way – put it in a closure.

var my_widget = (function (data_function) {
// to populate later
var data = [], oldData = [], semiOldData = [];
var an_index = 1;
 
function do_something() {
   // use subset of globals
}
 
function something_else() {
   // use some other globals
}
 
// etc.
 
function update(index) {
  an_index = index;
  data = data_function();
  // use all of the above
}
 
return update;
});

Now you get to create the widget with a simple function call. Hooray!

And the function returns its own update function so you can run an update whenever you need. All the state and weirdness is neatly packaged inside the closure, the code itself doesn’t need to know anything about the outside state.

By changing the update function a little bit you can even affect the internal state of the closure by calling the curried function.

Closures upon closures

Here’s where it gets even more magical. Stacking closures to achieve true greatness.

Code is the best way to explain what I mean …

// these functions are used to slice up data
var slice_functions = {
        students: function (item) { return !!item.cs_student; },
        others: function (item) { return !item.cs_student; },
        everyone: function (item) { return true; }
    },
        slice_func = slice_functions.students,
 
// these functions provide cleaned up data
// all must use the same main slice_func
        data_functions = {
            year_vs_pay: function (year) {
                var data = DATA.filter(slice_func).filter(function (item) {
                    return item.years_study == year;
                }),
                // ...
                return fin_data;
            },
            study_vs_pay: function (study) {
                var data = DATA.filter(slice_func).filter(function (item) {
                    return item.study_time == study;
                }),
                // ...
                return fin_data;
            },
            // ...

Those are our data functions, when creating new widgets we can provide them as the data_function argument shown above.

Now comes the tricky part – we can externally change the slice_func and all the data_functions (now safely tucked inside closures) change their behaviour by using the new slice_function since variables inside closures are pointers rather than copies.

Magic!

We have reached a situation where all code is tucked neatly inside closures. The closures themselves have no knowledge of the outside world, there are no flags they need to check, no external data anywhere. All they care about is running the data function and doing their thing.

And yet, through the magic of closures, we get to globally change their behaviour without worrying about internal state or having to call a specific function to do something on an object.

To me this feels cleaner than any abstraction object oriented programming has ever come up with.

Enhanced by Zemanta

3 responses so far

The one book that gets me offline

Mar 13 2012

There is a stack of books on my desk waiting to be read. They’re not bad books. Some are considered the height of classical literature, some are downright useful.

Unread.

Unread.

And yet, they linger, waiting for months upon months, some for years. I’ll get to them … eventually.

I used to be a voracious reader, going through books as if they were cookies. I still remember being eight or nine years old, waking up at 5am to read a book for two hours before getting ready for school.

Evenings looked pretty much the same, I’d go to bed at 9pm and just read. Anything. Everything. Nothing was safe from my reading appetite. Just one more page! Please, mum? was my catchphrase.

An internet

Then I got an internet.

I was still reading books. Mostly when school forced it upon me. Then I would devour a piece of classical literature in two afternoons. Because, you know, everything is easier at the last minute. And I would enjoy the book. Absolutely love it!

After the deadline … back to the internet.

This has gotten progressively worse to the point I simply don’t allow myself near a bookstore anymore. What’s the point in buying books if you never find the time to read them?

Brain snacking

Funny thing is, I’m still a voracious reader. I probably read, or at least scan, upwards of 50 blog posts every day. Count in all the tweets, facebook updates, forum posts, IRC conversations and HackerNewscomments and I probably read 50 pages of “books” a day.

Dark Tower

Dark Tower (Photo credit: fridayn)

50 pages.

Time … wasted.

Of all those blogs and comments and tweets and everything, most of it is just interesting. Something to keep my mind occupied. A little candy to keep me happy while I go on about my day.

Most of it isn’t even that well written!

But hey, it’s always right there. At the tip of my fingers. Something new always coming along to satisfy my voracious appetite for brain food. Like crisps in the cupboard or chocolate in the fridge, who’s got the time to prepare a meal when they can just barf down a snack?

The Dark Tower

Stephen King.

Roland on the cover of the comic The Dark Towe...

Image via Wikipedia

Reading his On writing changed my style forever. He advocates a plain spoken style, people today don’t have time to read. They don’t even want to read. You have to shove it down their throats. Tell them a cool story in a simple style and before they know it, they’ve just read a good book.

Uh-oh!

Head trick as Rausch would say. :)

And The Dark Tower is one hell of a story. It reads just like a blog post! None of that high english nonsense, just plain words, lots of swearing, sex and violence. But hiding a very deep and meaningful tale if you care to look for one.

The real winner is how the story is laid out. There’s a break every two or three pages. Plenty of chapters. Every chapter almost meaninglessly divided into subchapters.

Some a third of a page long. Some start in the middle of events.

Sounds annoying, but it’s brilliant.

What’s the biggest obstacle to reading a book? The commitment, before you is a bunch of text and you have to commit to reading all of it. Nobody wants to stop reading mid-sentence because the kettle is boiling.

Rushing to finish the page so you can keep your place … just because someone tweeted you and you have to respond.

The worst part of reading a book is not knowing when the next break is coming and only having an hour of time to read. You might happen upon a break, or you might not. If you do, awesome, if you don’t, you’re left with a subconscious sense of guilt that you started something and didn’t finish.

With Stephen King that problem doesn’t exist. You’re guaranteed to finish something every time you pick the book up. Even if you’re just taking a shit.

And the best part is, whenever you put the book down, it calls to you. It beckons in your dreams and you want to get your arse offline and continue reading. So you will go offline and finish the damn book.

Enhanced by Zemanta

5 responses so far

Webdevs, you have no idea how much you know

Mar 12 2012

A few weeks ago I decided I need a web designer in my close friends circle – someone to slap together designs for my half-baked weekend project ideas.

English: Book of Knowledge

Image via Wikipedia

So I took the nearest person with an eye for design and convinced her she’d be perfect for redesigning my blog. Completely out of her depth (is usually an architecture student), but after two days she learned enough inDesign to produce something we were both happy with.

Even made it all interactive and stuff!

But as every good designer guy who turns a pdf into html+css+js knows, the tough part isn’t drawing pretty pictures and making the information architecture work – the hard part is making browsers understand this stuff, possibly in a cross-platform way, with a touch of responsiveness thrown in the mix.

My days of being that guy ended towards the final throes of the War Against Tables for Layout. Back when :after { content: “:” } and :first-child were the state of the art and jQuery was gaining widespread popularity.

I can implement a half-baked frontend, but turning designers’ work into code is something I vowed never to do again! Soul crushingly maddening stuff that.

Time to teach my fledgling webdesigner all about html and css.

The Web, from scratch

Until I started teaching @ponywithhiccups I had no idea web development was this complex. It’s insane!

English: Icon for Notepad++

Image via Wikipedia

“Ok, so you use html for layout and then css styles it”

“Uhm …”

“Right, well, html is an xml-like markup language; the website is organized into tags that semantically tell the browser how things fit together”

“What’s a tag?”

“Oh … hmm … it’s just this <something>content</something> thing.”

“And what does it do?”

“Well, it tells the browser whether something is a paragraph or a header … and how things fit together … and under certain conditions it also tells the browser what something looks like … unless you have a css reset, then it doesn’t … oh and block elements always break into a new line, whereas inline elements do not …”

“Bwuh … what’s a css reset?”

“Right … well, css tells the browser how to render the page. Colours, fonts, even layout”

“But you just said html is for layout”

“Yes, well, css can rearrange that layout completely; html is really more about semantic stuff these days, but it used to be mostly for layout”

“Okay … then what’s an inline or a block element?”

“Oh you know, things like a and span are inline, but divs and headers are blocks. Blocks just mean it breaks into a new line if it needs to.”

“Maybe you should just show me …”

“Okay, just fire up a text editor … no not notepad … no, not wordpad either. Right … what’s a good text editor for windows anyway …”

We settled on notepad++, I’ve used it before and it’s got pretty good syntax highlighting for everything. Didn’t want to plunge her into emacs or something :P

“Right, so now you just write some html in here … oh and I should teach you about source control

“What’s source control?”

“Oh, that’s just so you never lose your history, so you can jump back if something gets really messed up.”

“Awesome! Wow, developers really think of everything, I wish I used some sort of source control elsewhere”

(I might be embelishing, but that’s the gist)

To the github

Git is this super simple thing right? Everyone who does any serious work with code can think in branches and pushing and pulling and commiting and merging … it’s second nature. Muscle memory almost.

An octocat

An octocat

Turns out this is a pretty damn complicated part of the process.

First you need a github account (you don’t, but it’s the easiest way to teach a newbie about offsite backups without telling them that’s what they are) … I mean, just teach these freshlings best practices from the get go. No need to explain too many details :)

She got a github account and groked the basics of using git pretty quickly. After every few characters you press ctrl+s, after a unit of work you rescan, stage changes, commit (in a gui) and when something works you  push.

Simple stuff.

A few days later I sent her the first pull request – now she knows all about social coding. She understands the value of Github is that people can see what you’re doing and pitch in to help when they want to. You have to pull their code to your local repository, then you get to play with merge conflicts and finally push it all back to Github.

She can even use gh-pages!

Although in retrospect, maybe I should have told her she can check out the html locally and doesn’t need to update gh-pages every time …

Teaching afresh

The best thing about teaching someone all this stuff from scratch, is that she is a completely clean slate. No preconceptions of how code works, no idea that tables used to be for layout, no <font> tag or anything else that is absolutely atrocious.

Teaching in Thekchen Choling

Image via Wikipedia

Here is a designer that will never know the world before html5 and css3, that considers this stuff as normal, not as something new and somewhat scary.

That’s a good thing!

Back when I was learning webdev the best advice for using table-less design was display: table-cell; Yup, it was!

Furthermore, I had no-one to teach me cleanly. To tell me about how the web works, that it’s a stateless protocol, that you have a frontend and a backend.

Perhaps back then it wasn’t even so cleanly separated, MVC backends were still an exciting new technology and AJAX only came into existence when I was already in the game for a few years.

Barely scratching the surface

You might think html and css are that simple thing anyone can do … that they’re just something everyone is born with at least a functioning knowledge of.

But here’s the truth, that shit is hard. And that’s not even getting into nginx servers, caching, http protocols, MVC backends, MVC frontends, databases, event-based stuff, multithreading and so on and on ad nauseum.

The average web developer’s brain contains so much knowledge it’s absolutely mindboggling! … and a lot of companies want to pay them peanuts, because hey, that neighbour kid “does websites” and he’d do it for free.

Enhanced by Zemanta

6 responses so far

Startup world, Y U SUCK AT MOTIVATE?

Mar 09 2012

The startup world is awash with truly inspirational stories and speeches, arguably the best of which is Steve Jobs’ Stanford Commencement Speech.

Muhammad Ali

The world of sports, also, is awash with inspirational stories and speeches.

But athletes have something the startup world lacks – motivation. That thing a trainer tells you before a big match to pump you up, to make you want to win, that burst of immediate motivation you need to overcome your own limits and win.

Watch any movie about sports, at one point the hero will want to pussy out, defeated by their own body. Somebody will give them a passionate motivational speech and the hero triumphs. Emotion. Power. Glory.

Startuppers … well, when somebody flounders, we give them advice. Weak, wimpy, advice. Fuck emotion right? Fuck passion, passion isn’t something you have passion is something you talk about having.

Screw you.

Inspiration is good! Inspiration is great! But before doing that important sales pitch, before walking into that VC’s office, before tackling that bug in your code, before quitting your job to do your own thing … that’s when you need motivation.

I could hypothesize for hours about why athletes [and some other physical disciplines] are so great at motivation and startuppers suck … maybe immediate goals are easier to define, perhaps being pumped and ready to kill doesn’t benefit us.

But you know what? None of that matters.

Before your next coding session, before that important 5 minute pitch, listen to these! Last night they helped me destroy 300 SQL queries for a request and shave off 5 seconds of load time.

HOW GREAT I AM [unembeddable]

Enhanced by Zemanta

6 responses so far

Science Wednesday: Towards a computational model of poetry generation

Mar 07 2012

English: Three quarter length portrait of Osca...

Image via Wikipedia

Towards A Computational Model of Poetry Generation is a paper by Manurung, Ritchie and Thompson (whomever they are) published in May 2000 and so far seems to be the best starting point for my graduation thesis.

There are three main parts to this story:

  1. why!?
  2. what makes it hard
  3. how it used to be done
  4. how it should be done

Obviously my idea of how it should be done matches somewhat with the authors of this paper, otherwise I wouldn’t hold it in such a high regard :P

Why!?

Poetry is a unique artifact of human natural language pro- duction, with the distinctive feature of having a strong unity between its content and its form. The creation of poetry is a task that requires intelligence, expert mastery over world and linguistic knowledge, and creativity. Al- though some researchwork has been devoted towards cre- ative language such as story generation, poetry writing has not been afforded the same attention. It is the aim of this research to fill that gap, and to shed some light on what often seems to be the most enigmatic andmysterious forms of artistic expression.

In short, this is a really cool problem to solve because it’s something that hasn’t really been done before. And it just looks interesting when you give computers – strictly logical reasonable machines – even the most modest of abilities to create art.

When rationalization is required … well somebody needs to create all those pop songs. Imagine if we could get a computer to write them, then sell them to all the pop music labels to feed to the Spears and Aguileras of this world. Marvelous!

What makes it hard

The problem with poetry is two-fold. On the one hand one finds themselves at a serious disadvantage in comparison to creating a traditional NLG(natural language generation) tool because poetry is less rigid. There is no message you are trying to convey and so the goal you are trying to achieve is a bit muddy.

English: Portrait of Allen Ginsberg and Bob Dy...

Image via Wikipedia

Furthermore, poetry possesses a certain unity between message and form. As Levin stated in 1962 “In poetry the form of the discourse and its meaning are fused into a higher unity”.

This creates a problem because traditional NLG systems are decomposed into simpler units of content determination, text planning and surface realisation. In poetry form and message are too intertwined to allow this approach.

The only advantage we might have from creating poetry instead of informative text, is that readers expect to do a lot of interpretative work, but realistically this again only serves to make it more difficult to define a goal for our algorithm.

Essentially: it’s hard to decide what we want and traditional well researched approaches break down. Great.

How it used to be done

Slovenska lipa srebrnik reverz

Image via Wikipedia

As with a lot of NLPresearch, there were several attempts at a strictly academic approach to poetry generation back in the 80′s. More recently, there have been several-ish web based attempts, but using similar techniques.

The problem with old approaches is that they were basically party tricks – humans generated extremely detailed grammars and poetic structures, so the computer ended up just semi-randomly filling in the words. While this produced good looking poetry and in case of RACTER even lead to publication.

Leaving aside considerations of whether the poetry at this point is even computer generated, all of these approaches completely ignored semantic meaning and most  poetics as well – rhythm, rhyme and figurative language.

How it should be done

Just as I’m planning to in my thesis, authors of this paper have decided to focus mostly on poetic form and ensure their results follow a strict verse, rhyming structure and other features usually attributed to classic poetry. Mostly because it is easy to pass off almost anything as modern experimental poetry and the more structure we can muster, the easier it becomes to actually verify results.

English: Jim Morrison in 1970.

Image via Wikipedia

The approach they suggest is a stochastic hillclimbing algorithm – particularly an evolutionary approach where the algorithm follows this kind of loop:

  1. Generate
  2. Evaluate

Generation is done by mutating the best candidates from the previous cycle through three simple constructs: Adding, Changing and Deleting.

So if you had a verse “John walked” it could become “John walked to the store, or “John lumbered“. Or for instance “John likes Jill and Mary“ it becomes “John likes Jill”.

Because of an integrated architecture (combining all of semantics, form, etc.) these changes can and should happen at any level so special care must be taken that changing the semantics of a verse, doesn’t negatively affect its rhythm. Although from the paper I don’t grok why exactly this is a problem, since the evaluation step should take care of negative mutations.

After we have a new population, these are then evaluated for correctness and the candidates with highest scores from the fitness functions get to go into the next round of mutations.

The authors go into little detail about assessing the different poetic structures, mostly because they have not yet cracked how to implement all of them. Detecting rhythm seems to be where they’ve made the most progress and a solution is suggested where we give the algorithm a target phonetic form, like this limerick:

w,s,w,w,s,w,w,s(a)
w,s,w,w,s,w,w,s(a)
  w,s,w,w,s(b)
  w,s,w,w,s(b)
w,s,w,w,s,w,w,s(a)

Where w means a weak stress syllable and s means a strong one. In parentheses the rhyming structure is described.

It is suggested that with the exception figurative language all the criteria can be dumbed down to numerical arguments that can be easily quantified through different means that are only loosely described.

They also go into a bit of formal detail explaining the sort of grammars that are used, but you should go read the actual paper if you’re interested in such heavily theoretical things :)

Here is an example of what their algorithm can produce:

Target semantics 

{john(1),mary(2), dog(3), bottle(4), love(5,6,7), slow(8), smile(9,10)}

Target Form 

w,s,w,w,s,w,w,s,
w,s,w,w,s,w,w,s

Surface

the bottle was loved by Luke
a bottle was loved by a dog

Stress

w,s,w,w,s,w,s,
w,s,w,w,s,w,w,s
Enhanced by Zemanta

Comments Off

Why geeks think girls don’t like them

Mar 06 2012

The oldest joke online is that geeks have never seen a girl.

Book at bikofe

Book at bikofe

Or that nice guys can’t get a girl.

Variations of this story have been happening all my life, my fellow geeks tell similar stories and the internet is awash with rage comics saying the same thing. But this particular story happened last night, to me.

On my way home from class I went to a nearby coffee shop to read a book – it’s a trick I use to get myself off the internets and reading proper books that are awesome.

Upon getting there, my regular spot, the only place with a good reading light, was occupied. Some girl was there, reading a book, minding her own business.

I plomped my arse down at a nearby table and tried to read. There wasn’t enough light.

After a few moments of thought I got up and asked the girl, if I could sit at her table because the light was better. She looked up from her book, smiled, said she doesn’t speak a word of Slovene, but that I should totally sit next to her since she’s hogging the only good light.

Sat down, thinking “My, that girl was kinda cute. Foreign too, I bet she’d be super interesting to talk to! Wonder what she’s doing here …” And I started reading.

After about half an hour, the girl stopped reading and just sort of sat there, looking kind of lost for a couple of minutes. I could almost feel her eyes peering through me … but the book was really interesting. I kept reading.

Bikofe

Bikofe

She stood up and wandered about the coffee shop, looking at different things on the wall and just generally looking like a person loitering around waiting for someone to afford an opportunity to be spoken to.

I was the only other person there.

Finally she decided to leave. But before she did she came up to me, gave me a super warm smile and a cute good bye. All I did was a Huh? Oh right, bye.

Opportunity squandered.

Here was a cute girl that would doubtlessly be really interesting to talk to, who actually wanted to talk to me. But I just didn’t give her a chance because I was there to read a book, damn it.

I think this is something us geeks do a lot. We pride ourselves on our laser-focused minds, being able to construct glass castles in our heads when tackling big problems, but we often shut ourselves out of random opportunities – what people call serendipity.

There was a line in my old startup pitch: Serendipity is looking for a needle in a haystack and finding the farmer’s daughter.”

Except for engineers the line would be: “Serendipity is looking for a needle in a haystack and finding the farmer’s daughter, then being pissed off that you couldn’t find the needle and going home without even saying Hello to the daughter.”

And that’s why the internet’s oldest joke is that geeks have never seen a girl.

PS: this likely also has a lot to do with how different business-type founders are from engineer-type founders, that openness to random opportunities that pop up everywhere. Definitely something engineers should work on :)

 

 

Enhanced by Zemanta

4 responses so far

« Newer - Older »

« How to make your django app slow Science Wednesday: Towards a... »