The recent post on Hacker News featured Transformy, an application that allows you to transform strings e.g., change date or name formatting, without having to program anything. Instead you give it an example by transforming one string from your batch. It tries to infer the rule that you used and apply it to all other strings.

I was so excited about this I killed some time and reproduced similar functionality with a hudgred lines in Python, see here. By far the script reproduces examples from the Transformly website:

>>> transformer = StringTransformer()
>>> transformer.train_by_example('Joel, 1949, piano', '{name: \'Joel\', instrument: \'piano\'}')
>>> print transformer.transform('Lennon, 1940, guitar')
{name: 'Lennon', instrument: 'guitar'}

It is obviously very limited in functionality, mainly because it requires all strings in the batch to have a very similar structure. Another problem is ambiguity: when you see an example like 02-02-2014 -> Day 02 Month 02 Year 2014 you cannot infer which position in the first string corresponds to days.

Naturally, this kind of ambiguity could be resolved by looking at multiple examples. This is what a (seemingly) more advanced tool, Microsoft Excel FlashFill can do. I could think of several ways to improve my script allowing for multiple examples in an imperative fashion, but something tells me that is not the way. It would be way cooler to rephrase the entire problem in probabilistic terms.