views:

74

answers:

2

I'd like to have a simple & lightweight library/application in PHP/Python/C/C++ library/application to match/correct/give suggestions to input. Example in/out:

  1. Input: Webdevelopment ==> Output: Web Development
  2. Input: Web developmen ==> Output: Web Development
  3. Input: Web develop ==> Output: Web Development

Given there is database of correct words and phrases, I just need the library to match/guess phrases. Please suggest if you know any. Thanks in advance.

+3  A: 

I guess what you want to do is compute the edit distance between strings (an input, output pair). One of the simpler ones (that I've used for figuring out a team's full name from it's 3 letter short one - it's a long story..) is the Levenshtein distance. The last external link on the page has a bunch of different implementations of it (turns out it's standard on PHP 4.0.1+).

Eugen Constantin Dinca
+1 Thanks Eugen.
Viet
+3  A: 

How to Write a Spelling Corrector from Google's Director of Resarch Peter Norvik contains a spelling corrector in 21 lines of Python, complete with explanations.

You will have to convert this into a module yourself, but that should be easy. Of course, you will also need a corpus (i.e. words), but he gives sources for these as well.

oefe
That's a very interesting article (and at the end of it you'll find links to implementations in a bunch of other languages as well).Thank you.
Eugen Constantin Dinca
+1 Thanks! Great find!
Viet