note 29815 added to function.soundex

From: Date: Tue, 25 Feb 2003 23:34:51 +0000
Subject: note 29815 added to function.soundex
Groups: php.notes 
Request: Send a blank email to php-notes+get-44522@lists.php.net to get a copy of this message
administrator at zinious dot com: Sorry but your code wasnt soundex compliant here were my results with your code, my code, and the default.. string: rest R620 perform administrator's function 0.009452 R230 perform cg's function 0.001779 R230 perform default soundex function 9.4999999999956E-005 string: reset R620 perform administrator's function 0.0055900000000001 R230 perform cg's function 0.00091799999999997 R230 perform default soundex function 0.00010600000000005 i dunno why the default, every once in a while, will for some reason be 9.xxx. very odd i think.. my code is at the bottom.. these tests were before the soundex modification as i discribe below.. btw for all the original specs on the soundex algorithm goto http://www.star-shine.net/~functionifelse/GFD/?word=soundex dalibor dot toth at podravka dot hr: yes it is perhaps sad that it gives you the same code, even metaphone has that problem.. but one might not want to be so accurate.. if somone is on search engine.. lets call it shmoogle looking for "php array reset" and search for "php array rest" then shmoogle might return stuff about beds and such.. (if they were all stupid and didnt use the first words as more important) so anyways shmoogle might need it to be less accurate in such cases.. but nonetheless.. my fix for this is to add the number of syllables at the end of the string making it 5 characters long.. this would work as fallows.. code at: http://star-shine.net/~functionifelse/cg_soundex.php or if you wanted to just use the default soundex function $str = soundex($str).cg_sylc($str); revolutionary more or less.. problly less... This function is only meant for one word though.. i'd like to see someone modify it to use split and run it through a loop to get each words cg_soundex that'll be fun ;) i would also like to sujest to the php zend apache kinda people who make php to add an optional additional variable the user can specify as fallows soundex("string",SYL); which would return the number of syllables at the end of the string highly accurate sound testing woo! also you could add VOW for vowels and CONS for consonant or whatever else someone would want.. but i really think the number of syllables will be pleanty efficiant. umm.. if this helps anyone your welcome.. ummm.. good luck in all your php adventures.. oh... and the final results syllables 1 rest 2 reset metaphone RST rest RST reset soundex R230 rest R230 reset string: rest R2301 perform cg's function 0.00211 R230 perform default soundex function 0.00011299999999997 string: reset R2302 perform cg's function 0.001691 R230 perform default soundex function 0.00010399999999999 the default function is a tad bit faster.. so maybe they will add this option and we'll have speed and accuracy. SILENT WIND OF DOOM WOOSH! -- http://www.php.net/manual/en/function.soundex.php http://master.php.net/manage/user-notes.php?action=edit+29815 http://master.php.net/manage/user-notes.php?action=delete+29815 http://master.php.net/manage/user-notes.php?action=reject+29815

« previous php.notes (#44522) next »