Monday, January 30, 2006

The \\ command for auto-fixing typos in yubnub commands

I like the \\ command because it has a bit of a story to it. But first, what it does: it automatically corrects typos in your yubnub commands. For example, if you type \\ g paecekeepers, it will automatically convert this to "g peacekeepers" and do a Google search for peacekeepers.

The challenge was laid down by kore7 yesterday:

Wondering whether we couldn't use Google to create a universal spell check command as well. When an unrecognized word is submitted to Google, it usually returns with "Did you mean: X?", where X is almost always what you meant to type. I'm envisioning a YubNub prefix command called "?"...

This seemed pretty hard to me, so I just gave some encouragement but didn't think it would be done, at least not anytime soon:

Heh - that's an interesting idea. Perhaps the first step is to create a command called respell that returns the google-fixed spelling of a given word. Once that's in place, it would be trivial to create the ? command.

The indefatigable Eliazar rose to the challenge and actually made an attempt:

I managed to scrape Google's spelling suggestion consistently with a command I created, sp1. Now I want to work with this result but I'm not able to pipe this command...

An hour and a half later, Brian Armknecht was inspired by Eliazar's code and took it a step further:

Eliazar -- Check out the ?> command. I just built it based on your sp0 command.> I added an ifthen to return the original input if the spelling was correct. This seems to work with piping. e.g.: g {?> cmbodia}

So, much of the hard work was done; what remained was to create a single command to tie everything together and answer kore7's original challenge. And that's what Jacob Ensor did, with assistance from Anastas and myself:

Took me all day, but I've done it. I've implemented your spellcheck in this new command, check it out: \\

Checks the spelling of your input of any Yubnub command.

\\ gim cmbodia (performs a google image search for "cambodia")

Go ahead try it! AWESOME! LOL.

And it's funny how these wonderful advancements and incremental improvements build on the work of early YubNub pioneers and experimenters: Fuska's % command for positional parameters, Jeremy Hussell's suggestion of a url command, Sean O'Hagan's ambitious scrape command, Allen Ormond's handy ifthen command.

Actually I feel moved as I consider all these people striving together to advance this idea of the URL as command line.


Anonymous magicjj said...

Thanks for everyones help. The \\ command now uses Eliaziars great "spllw" command. Eliaziar caught a glitch using multiple words with the command, and this new command perfects it.

Jacob Ensor

1/31/2006 2:29 p.m.  
Blogger Jonathan said...

magicjj - yay!

1/31/2006 7:25 p.m.  
Blogger Klink said...

How about one to correct misspelled commands?

For example: \\gmi ferrari
google image search for ferrari.
I suppose if there's a command for gmi it wouldn't work, but still...

9/19/2007 9:47 a.m.  
Blogger Jonathan said...

Klink - interesting idea!

9/20/2007 1:10 a.m.  

Post a Comment

<< Home