Friday, August 29, 2008

(Smart)Find for Firefox 3.*

Inspired by our own need and other's, a couple of friends (André, Roberto and Tomaz) and I decided to increment Firefox' default find feature.


If you use Firefox, you had probably used the Firefox' findBar already. It is the simple and intuitive way users have to search for words in a web page. The main thing we "miss" is that it requires the user to type the exact (set of) word(s) he searches for to actually find it. Sometimes, however, lazy enough users *like us* want to just give the findbar a "clue" of what we want to find in the page, and even often just do not know. The result of that was the SmartFind addon for Firefox 3.x. From its site we have some usecases of SmartFind:

  1. "Schwarzenegger". This looks easy when you are looking at the word, but what if you do not have any idea what to write? Then you wonder "I would like to write something like "chuazenger" and for it to find similar words in the page".
  2. As another example, when you are on a page where accents are used and your keyboard is not configured to type such accents (~^`), the traditional find method will not be able to match with any word.
  3. You are just lazy like us and terrible in orthography :)

Smartfind ranks how similar each word in the page (yeah, that might take time depending on the webpage ... heuristics exists to speed it up, but new ones are welcome) is to the given word (input by the user). For such, we are implementing the levenshtein distance metric. The "how similar" can be trigged by the user through the Edit->SmartFind menu, to be more or less restrictive.

Well, in practical terms, whenever Firefox' original find method does not find something, SmartFind takes place and hitting a aditional "enter" fires its actition ...

If it is still not clear, see sshots bellow:

User is not from Austria and does not know how to spell this-big-name-above.

SmartFind finds it for him.

Disclaimer: This is just the first and quickly implemented public release, so there are some known problems:

  • Improve the way it gets text content from the webpage (better xpath expression, which ignores "object" , "style" , "script" tags' text content).
  • Fix problems with line break (lack of "br" tag) .
  • Implement an user-intuitive way to walk through the list of most similar items found: currently we are static to the top of the list.
  • Implement a fuzzy third state (similars ?) while comparing chars that could make SmartFind work much better: "for example, consider 'ë' as not completely different from 'e' or 'é' but similar". That done, the Finnish word "päivää" would be more similar to "paivaa" and so on ...
  • Port it to Fennec (Firefox-Mobile) browser.
  • Make it work with other Firefox addons, including FindInTabs.
  • Implement SoundEx into it (?).

--Antonio Gomes
tonikitoo at gmail dot com


blizzard said...

This is totally awesome. Seriously.

Anonymous said...

Brilliant, thanks!

This is also the first time I've seen a non-Maemo post on Maemo Planet that I enjoyed.