simpleWordsCloud/common.php

17 lines
459 B
PHP

<?php
function areWordsSimilar(string $word1, string $word2)
{
$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;
}