Thursday, May 7, 2009

Savant: The Natural Language Shell

How many times have you stared at the contents of a folder for 5 minutes trying to carefully select the files that you want to copy to your thumbdrive? Maybe you want to remove all the zip files that you downloaded off the web today. Or maybe you want to make a backup of all the folders matching the name hwX where X stands for a number.

Sure you can do these things with the file manager of your choice. The most naive user would go and manually select every one of the 20 items he is thinking of. In the process, maybe, he clicks an empty area on the screen and his whole selection goes away. Since there is no UNDO feature in file managers, he has to start over again. (Makes me wonder why hasn't anybody thought of this).

A more average user, or more likely, a user with a very clear query in his head will probably use the search feature built in to most file managers. The user fills in numerous checkboxes, fills in the details of whatever he remembers about his query. Hopefully, if the search is narrow enough the right results show up and the user is happy. However, more often that not, using the search feature can be a bit tedious. Ask yourself, how likely are you to use search when you want to copy, delete, move or zip more than 10 files.

On the other end of the spectrum, the macho command line geek will probably laugh at this problem. He will promptly bring up a terminal window and type in some obscure commands involving ls, rm with a bunch of regular expression arguments along with -l -u and what not. If the query is a bit more complicated, and the user is intellectually challenged, he will write a shell script to do the job for him. However, the truth is, on average cases, the command line geek will get his job done faster than the other user groups.

No, I am not advocating the use of command line in our daily lives. But, do you notice that, in a way, the more technologically inclined you are, the faster you can get things done. If you are not so good with computers you will probably end up following medival ways of doing things. However, getting things done fast doesn't come without a cost. As a user, you are trading off intellectual effort of command line trickery for boring and repetitive chores. Unfortunately for most users, there is no trade-off to make. Such users resort to the latter way of doing things.

So is there a sweet spot between tasks of high intellectual effort and the brainless and repetitive ones? Personally, I think so. In this article I will try to explain what motivates me to think in such a manner.

To put things into perspective I will zoom out a bit more and talk about a more fascinating trend. Back in the days of the first browsers, the address bar was a place where you just typed in the actual domain name. Search engines were not so popular back then. So it was important that you remembered the web address precisely. As browsers got more advanced they started packing more juice into the address bars. First came the drop down of addresses from the history. If you have visited a site in the recent past, all you have to remember is the first few characters of the domain name. A significant reduction in intellectual effort, a new potentially brainless chore. With the advent of Firefox 3, the address bar became even more "awesome". You could get away with typing only a part of the actual domain name, page title, or even tag name. This new feature quickly spread like wildfire and was adopted by every other browser in the market. With the smarter address bar, daily browsing reduced to typing in a few key strokes. Google Chrome took this even further by displaying Google search results as you type in.

Now, I ask the question again. Do you see a trend. With every new addition, we are actually accomplishing a much more complicated task. We started of by pointing the browser to a specific location on the web. We then progressed to doing a domain name search on our recent browsing history. That got elevated to performing a string search of titles, domain names, bookmarks, and tags from the history. Finally we ended up performing an actual web search on Google along with everything else. However, the actual intellectual effort of performing these increasingly complicated didn't go up that much. It is still pretty much limited to a few key strokes that we easily get used to.

So the moral of the story, it is possible to do complex tasks without doing much. Which brings us back to the issue of selecting, copying, and moving files with your file manager. The current state of the art approach to this problem is to use the sort and search functions of the manager to set things up to do whatever you want. Imagine if you had to do the same with web browsers. Instead of the address bar auto-completing recently visited sites, what if you were shown a list of all pages you have visited recently. Then you had to sort that alphabetically, or by recency, and then perhaps do a search to find what you are actually looking for. Fortunately browser UI designers have been clever enough to spare us the horror of going through all that.

So you see, the way we do things in a file-manager is pretty silly. We somehow fail to realize how silly it is until an analogy is shown to us. What if we could tell the file manager what we want? What if we could tell: "Delete all the zip files created today". Or maybe, "Move all files starting with hw to Documents/School/". Command line people may instantly conjure up the appropriate shell commands for each of those tasks. And that's exactly my point, we need something as powerful as the command line, but for average users. We need something that can understand commands given in natural language and perform them. I'm not talking about having a conversation with the computer. We just need to be able to give domain specific commands in natural language.

Savant, is a proof of concept of such an idea. It is a natural language shell to perform routine tasks that we do using a file manager. It is simple in the sense that it can perform only a handful of tasks, but it is also powerful in the sense that it can perform those tasks on any complicated query that we describe in natural language. What's more exciting about this idea is, Savant need not be a solution for a handful of problems. It can be as extensible as Firefox. Developers should be able to extend the program to do more interesting tasks. Alongside, they can also specify the natural language commands using plain old context free grammars. To make parsing easy, the front-end can suggest syntax as the user types in his command. This way, it is clear for the user what the system can and cannot understand.

Sounds interesting. Stay tuned for more updates...

No comments: