PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > String Comparison Threshholds
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
String Comparison Threshholds

Réponse
 
LinkBack Outils de la discussion
Vieux 22/02/2008, 21h44   #1
Travis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut String Comparison Threshholds

I understand its possible to locate substrings within a string (http://
http://www.cplusplus.com/reference/s...ring/find.html) but is it
possible to compare two strings for a particular threshold of
similarity. Like saying return true if string1 and string2 are say,
80% alike?

  Réponse avec citation
Vieux 22/02/2008, 22h00   #2
Hans Mull
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: String Comparison Threshholds

Travis schrieb:
> I understand its possible to locate substrings within a string (http://
> http://www.cplusplus.com/reference/s...ring/find.html) but is it
> possible to compare two strings for a particular threshold of
> similarity. Like saying return true if string1 and string2 are say,
> 80% alike?
>

I don't think STL can do this, but there are many libraries with such
algorithms.

Best regards
  Réponse avec citation
Vieux 22/02/2008, 22h27   #3
Travis
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: String Comparison Threshholds

On Feb 22, 2:00 pm, Hans Mull <hans72m...@aol.de> wrote:
> Travis schrieb:> I understand its possible to locate substrings within a string (http://
> >http://www.cplusplus.com/reference/s...ring/find.html) but is it
> > possible to compare two strings for a particular threshold of
> > similarity. Like saying return true if string1 and string2 are say,
> > 80% alike?

>
> I don't think STL can do this, but there are many libraries with such
> algorithms.
>
> Best regards


I figured there might be I was just trying to get some
recommendations. I know I have boost installed but can't seem to find
the functions to fit.

Thanks for the info.
  Réponse avec citation
Vieux 22/02/2008, 22h28   #4
Juha Nieminen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: String Comparison Threshholds

Travis wrote:
> is it possible to compare two strings for a particular threshold of
> similarity. Like saying return true if string1 and string2 are say,
> 80% alike?


Of course it's *possible*. However, if what you wanted to ask is
whether there exists a standard library function to do that, then the
answer is no. If you want such a function you'll have to write it
yourself (or find a third-party library which has such a function).
  Réponse avec citation
Vieux 22/02/2008, 22h46   #5
AnonMail2005@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: String Comparison Threshholds

On Feb 22, 4:44pm, Travis <travis.bow...@gmail.com> wrote:
> I understand its possible to locate substrings within a string (http://www..cplusplus.com/reference/...ring/find.html) but is it
> possible to compare two strings for a particular threshold of
> similarity. Like saying return true if string1 and string2 are say,
> 80% alike?


Check out the definition of Levenshtein distance:
http://en.wikipedia.org/wiki/Levenshtein_distance

The article has many good pointers to other definitons
of distance or likeness.

You can find an implementation on google by searching
for the above along with the term C++.

HTH
  Réponse avec citation
Vieux 22/02/2008, 23h30   #6
Phil Endecott
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: String Comparison Threshholds

Travis wrote:
> I understand its possible to locate substrings within a string (http://
> http://www.cplusplus.com/reference/s...ring/find.html) but is it
> possible to compare two strings for a particular threshold of
> similarity. Like saying return true if string1 and string2 are say,
> 80% alike?


Maybe "edit distance" is the thing you need to search for?

My own (GPL) implementation is here:

https://svn.chezphil.org/anyterm/trunk/common/diff.cc

If you search for "edit distance" in the Boost mailing list archive I
think you'll find at least one implementation proposed. (IIRC, I
complained that it was not optimal; the author them presented a much
better version.)


Phil.

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 23h12.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12203 seconds with 14 queries