Add the use of soundex_fr for word comparison
This commit is contained in:
parent
7c1707dea0
commit
97c75691ce
3 changed files with 85 additions and 4 deletions
12
db.php
12
db.php
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once 'soundex_fr.php';
|
||||
|
||||
class DataBase
|
||||
{
|
||||
|
@ -281,9 +281,13 @@ class DataBase
|
|||
|
||||
function areWordsSimilar(string $word1, string $word2)
|
||||
{
|
||||
$sim = similar_text($word1, $word2, $perc);
|
||||
$sim_meta = similar_text(metaphone($word1), metaphone($word2), $perc_meta);
|
||||
if ($perc >= 75 && $perc_meta >= 80) {
|
||||
$word_sim = similar_text($word1, $word2, $word_perc);
|
||||
$meta_sim = similar_text(metaphone($word1), metaphone($word2), $meta_perc);
|
||||
$sndx_sim = similar_text(soundex_fr($word1), soundex_fr($word2), $sndx_perc);
|
||||
if ($word_perc >= 90 || $meta_perc >= 90 || $sndx_perc >= 90) {
|
||||
return true;
|
||||
}
|
||||
if ($word_perc >= 80 && $meta_perc >= 80 && $sndx_perc >= 80) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue