note 105111 deleted from function.similar-text by danbrown

From: Date: Thu, 28 Jul 2011 19:09:22 +0000
Subject: note 105111 deleted from function.similar-text by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181973@lists.php.net to get a copy of this message
Note Submitter: dzek at dzek dot eu ---- Just an info for people that want to use function posted by georgesk at hotmail dot com @ 09-Mar-2002 04:14. 1) Sometimes it produces totally different values than similiar_text! You are warned. Example below. 2) In most cases it's extremly fast (function is looped 100 times) <?php $s1 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam sollicitudin turpisaaaadda sdk saasasvcxvs kda'; $s2 = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam libero arcu, laoreeaaaabfdwasdsad sadsa '; // results: // similiar_text time: 2.1294770240784 | similiar_text score: 78.301886792453 // get_lcs time: 0.0097081661224365 | get_lcs score: 78.301886792453 $s1 = 'askdjsal kjdklasj dlksajd lksajd lksajd lkasj dlkasj dlksjad lkasj dlkasjd lkasjd lksaj dlkasj '; $s2 = 'ksafm sadkp jdfsapiqw-0 r329302=1r 90329i r0=qw oid0-qwi - i[wqef okw fwiq0[ iwq0-[q0 uiw0 i i jp[ i'; // results: [notice different score!] // similiar_text time: 1.8132481575012 | similiar_text score: 25.510204081633 // get_lcs time: 0.01570200920105 | get_lcs score: 9.1836734693878 ?> I've tried a lot of strings and unfortunately - one pair of them caused get_lcs to get 55 seconds score (tried 3 times). You are warned. Too bad I lost the strings and can't provide an example.

« previous php.notes (#181973) next »