Wednesday, January 2, 2013

Question For My Readers: How Would You Implement This?

Update: Answer's apparently zsh.


Peter Norvig showed that it's incredibly easy to write a probabilistic spelling corrector in a very small number of lines of code. His readers, which means virtually every hacker on the planet, have ported or re-implemented his demo in a staggering number of languages.

Meanwhile, I added this to my bash profile:

alias rpsec="rspec"

I could probably re-implement Norvig's solution without even re-reading it; I read one of his AI books years ago and built an entire breakbeat improviser around probability. But where I want that probabilistic spelling corrector is in the shell. And I have no idea how you would add that to the shell, although I think some shells might already even have it.

A) Do you know which shells those are?

B) Do you know how hard it would be to add this to bash?

If you have a good answer, please email it to me or tweet it: