Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Fuzzy searching with the Fox
Message
De
22/09/2009 17:37:47
 
 
À
22/09/2009 16:42:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01425615
Message ID:
01425679
Vues:
71
>>>>Any way to do fuzzy searching in VFP.
>>>>
>>>>Preferably in french ;-)
>>>>
>>>>If you can provide some code then I guess I can adapt for french.
>>>
>>>What exactly are you trying to do? For indexed searches there is GOTO RECNO( 0 ) / SET NEAR. For character strings there is SOUNDEX() / DIFFERENCE().
>>
>>I'm trying to do the following;
>>
>>If user enters he's looking for "Rene" I want to find "Rene" and "René" for example.
>
>You could potentially use DIFFERENCE() or SOUNDEX().
>
>?DIFFERENCE( "Rene", "René" ) &&4
>?DIFFERENCE( "Rene", "Rend" ) &&3
>?DIFFERENCE( "Rene", "Remd" ) &&3
>?DIFFERENCE( "Rene", "Rané" ) &&4
>?DIFFERENCE( "Rene", "Sané" ) &&3
>?DIFFERENCE( "Rene", "Sené" ) &&3
>?DIFFERENCE( "Rene", "Bané" ) &&3
>?DIFFERENCE( "Rene", "Bamé" ) &&3
>
>* so, you could experiment with
>IF DIFFERENCE( SomeColumn, "Rene" ) = 4
>
>* SOUNDEX() is more difficult to interpret:
>?SOUNDEX( "Rene" ) &&R500
>?SOUNDEX( "René" ) &&R500
>?SOUNDEX( "Remd" ) &&R530
>?SOUNDEX( "Remé" ) &&R500
>?SOUNDEX( "Relé" ) &&R400
>?SOUNDEX( "Redé" ) &&R300
>?SOUNDEX( "Resé" ) &&R200
>?SOUNDEX( "Sene" ) &&S500
>?SOUNDEX( "Réjean" ) &&R250
>
>* maybe if you force the first letters of the SOUNDEX() results to be the same,
>* and the remaining numbers to be "close" e.g.
>lcSoundexChar1 = LEFT( SOUNDEX( SomeColumn ), 1 )
>lcSoundexChar2 = LEFT( SOUNDEX( "Rene" ), 1 )
>lnSoundexVal1 = VAL( RIGHT( SOUNDEX( SomeColumn ), 3 ) )
>lnSoundexVal2 = VAL( RIGHT( SOUNDEX( "Rene" ), 3 ) )
>
>IF lcSoundexChar1 ==  lcSoundexChar2 ;
>  AND ABS( lnSoundexVal1 - lnSoundexVal2 ) < ( some numeric value )
>
>* you might be able to combine them,
>* do a quick check with DIFFERENCE(),
>* then fine-tune with SOUNDEX()
>
Thanks Al. I have a better understanding of those now.
*******************************************************
Save a tree, eat a beaver.
Denis Chassé
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform