Rise of the machines: can computers learn how to write?

New software is being tested which will mimic a person’s exact handwriting style

Machine learning might just be the solution to the lost art of letter writing. Researchers at University College London (UCL) have developed an algorithm that can take a sample of anyone's handwriting and reproduce the exact penmanship. This means you won't have to worry about intelligent software taking over the world because it will be too busy writing thank you notes and doing your Christmas cards for you.

Whimsical images aside – were you imagining a little robot with a pen in its hand? – the machine learning software used to replicate something as unique as an individual’s handwriting is quite complex.

Dr Oisín Mac Aodha, one of the researchers working on the My Text in Your Handwriting project that yielded this software, says: “First of all there was the academic question of ‘can we do this?’ or ‘how well can we do this?’. We felt that this wasn’t fully understood until we started working on it. We’re not saying this [project] is the final, perfect answer to this question but it’s certainly one step in that direction.”

The question is whether it is possible to develop software that can learn to mimic the exact handwriting style of any individual to the point where an onlooker could be fooled into thinking it was produced by a person rather than a machine. This is almost like a version of the famous Turing test whereby a computer can can fool a person into thinking they are conversing with another human being.


The idea came about when project leader Gabriel Brostow received a letter in the post from his bank. It was one of those letters containing a new card; the bank was trying to hide the fact that it was sending out sensitive information by having fake writing visible through the window of the envelope.

The only problem was that the conspicuously fake writing might actually draw attention to the fact that it was likely to be official correspondence.

“Banks are trying to produce something that looks handwritten so that if someone was snooping through your mail they wouldn’t think there was anything interesting there and would pass it up,” says Mac Aodha.

Reproducing artificial but convincing handwriting, however, is a complex task that requires machine learning, an area of computer science that dates back to the 1950s. A pioneer of the field, Arthur Samuel, defined it as a "field of study that gives computers the ability to learn without being explicitly programmed". In other words, computer scientists develop algorithms that allow the computer to learn how to master specific tasks when given large quantities of relevant data.

‘Elementary, my dear Watson’

In the case of the handwriting software developed by Mac Aodha, Brostow and

Tom Haines

of UCL, it was learning how to write in a distinctive style but only after being fed several samples. Some notable examples include the penmanship of Sherlock Holmes creator

Arthur Conan Doyle

. In what looked exactly like his writing in black ink on parchment, the words, “Elementary, my dear Watson” appear although never uttered by the author.

The software observed what we do naturally without thinking, says Mac Aodha.

“The flow of your handwriting as your pen leaves the line and comes back towards the end of the page has this distinctive arcing effect. And we have unique ways of bunching letters together towards the end of the line or how certain letters flow into each other – or don’t,” he says.

“All of these subtleties need to be captured in order to be convincing and that’s taking into account that people can be inconsistent: sometimes we join all the letters and other times it can appear almost printed.”

The algorithm is trying to learn about your style from the samples presented in order to be able to generate something new that you haven’t actually written. This involves convincing visuals: as we write on paper in ballpoint pen, the ink usually appears lighter as the pen runs out and when we lean harder on the pen, ink can appear denser in parts.

While we don’t explicitly think about these things as we scan a handwritten letter, they define its authenticity and, as with many things, spotting a fake is a case of “I know it when I see it”.

Mac Aodha and his colleagues put their algorithm to the test by recruiting participants to look through examples of real and computer-generated writing.

In one experiment they showed a bunch of envelopes to the participants: half were real and half were fake. They had to guess which were which; they were only able to do so 40 per cent of the time. Given that a blind guess is 50/50, the results were promising.

“The algorithm did a pretty good job of fooling everyone,” says Mac Aodha.

This software is not a one-trick pony. It has applications including personally handwritten “thank you” notes and birthday cards and, perhaps most interestingly, restoring the handwriting of stroke survivors and others who have lost the use of their hands.

“Handwriting is, in some ways, a dying art form. It’s nice to be able to breathe some life back into it and, in a way, highlight its subtleties and beauty,” Mac Aodha says.

Machine poetry: Wandering lonely as a server

Machines may be able to convincingly reproduce words in our handwriting but can they write poetry like Wordsworth? Poetry generating software has been around for some time, so maybe it is not for us to judge whether the resulting poetry is worthy of praise. However, a literary publication could be the final judge.

CuratedAI describes itself as “a literary magazine with a twist” because “all stories and poems are generated by machines using the tricks of the artificial intelligence trade”. The only submissions accepted to this unique online publication are those written by software; no human poets allowed.

Obviously the software itself is neither sufficiently motivated nor independent of mind to chance upon this website and submit some of its finest work, so it is up to the person behind the software to do so. A quick browse through the site reveals plenty of poetry and prose to peruse.

Here is an excerpt from the aptly titled Computer by Deep Gimble I, a machine-learning algorithm trained on public domain poetry: "computer by a roadside in the river where you go back into houses of sand as i do in a valley of wood with my garden i am a small man who is the first the same of your body"

Deep Gimble I was created by Karmel Allison, the software engineer and data scientist behind the literary magazine. Drawing on the public domain dataset from which it “learns” how to write poetry, the software has access to a vocabulary of more than 190,000 words. It is seeded by a single word, meaning that it accepts one word as input and uses this as “inspiration” for the resulting poem, which is written in under one minute.

Is this art? Is this truly creative? One thing for sure is that it is now a legitimate literary genre: machine poetry.