Let’s say i have two sentences:
“The quick brown fox jumps over the lazy dog”
“The quick brown bunny jumps over the lazy cat”
Is there an algorithm to detect similarity ratio of these two sentences ? For example:
function similarity_ratio($text1, $text2) {
code code code
return $similarity_ratio;
}
$text1 = "The quick brown fox jumps over the lazy dog";
$text2 = "The quick brown cat jumps over the lazy chicken";
echo similarity_ratio($text1, $text2);
// output 88%
1 Answer