Monday, October 23, 2006

Easywords

Ok ... I finally started studying for my GRE ... :-) and I spent a couple of hours creating this !!!

The plan is to recognize as many words that we are most familiar with and prompt meanings and synonyms of words that are probably new.

I also started a new Google project called "Easywords" and hosted the simple Javascript code.

Out of all words available in a give paragraph I remove any of known words (these known words is a simple list of words that I compiled within the code itself). In doing this I remembered a nice feature in Ruby that used to popup among the code snippets shown in main page of the Ruby web site.
The code snippet from the Ruby site is shown below:

cities = %w[ London
Oslo
Paris
Amsterdam
Berlin
Colombo]

visited = %w[Berlin Oslo]

puts "I still need " +
"to visit the " +
"following cities:",
cities - visited

The output of the above snippet is :

I still need to visit the following cities:
London
Paris
Amsterdam
Colombo

I'm not an expert in Javascript and I had to implement this manually to use the known list of words to search in the given paragraph to find occurrences of those words and remove them. But I'd love to find a better way to do this (like in what we can do in Ruby) in Javascript. If anyone of you out there have a better way... do send a patch :-) !!!