Hello,

I would like to find out if there is a c++ library that supports fuzzy string search. If I have a list of words such as: hello, there, cool. But I search for 'Helo' I would get Hello. I assume this is a solved problem for spell checkers. Anyone can suggest a ready to use library for that purpose?

Thank you.

Perhaps make a function that compares the similarity between two words. Compare each word length, how many of the same characters match up, how many are in the right order, and so on. The function could start off like this:

/* Returna a value between 0 and 100
 * 0   = No match
 * 100 = Perfect match
 *
 * Allow a 10% to 15% tolerance
 *
 */

int compare(char *word1, char *word2) {
  int similarity;

  /* Compare words */

  return similarity;
}

Hope this helps.

Thanks William, thanks for the suggestion. I understand how it can be done. But before I jump in and start implementing it myself I would like to make sure that I can not use the code that already exists. It seems reasonable to expect that such a code exists, though.

Thanks William, thanks for the suggestion. I understand how it can be done. But before I jump in and start implementing it myself I would like to make sure that I can not use the code that already exists. It seems reasonable to expect that such a code exists, though.

Maybe in 3rd party library. Use William suggestion. Also these function
might come in handy, they are in cctype header.
cctype

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.