Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
SimpleStringComparator.php
1<?php
8
15 public function getSimilarity( $addedMessage, $deletedMessage ) {
16 if ( $addedMessage === $deletedMessage ) {
17 return 1;
18 }
19
20 if ( trim( mb_strtolower( $addedMessage ) ) === trim( mb_strtolower( $deletedMessage ) ) ) {
21 // This is an arbitrarily chosen number to differentiate it from an exact match.
22 return 0.95;
23 }
24
25 return 0;
26 }
27}
A simple string comparator, that compares two strings and determines if they are an exact match.
An interface to be implemented by comparators that will compare percentage of similarity between stri...