Add the use of soundex_fr for word comparison

This commit is contained in:
Gregory Trolliet 2020-11-23 23:27:33 +01:00
parent 7c1707dea0
commit 97c75691ce
3 changed files with 85 additions and 4 deletions

12
db.php
View file

@ -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;