|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* |
|
5
|
|
|
* @Name : similar-text |
|
6
|
|
|
* @Programmer : Akpé Aurelle Emmanuel Moïse Zinsou |
|
7
|
|
|
* @Date : 2019-04-01 |
|
8
|
|
|
* @Released under : https://github.com/manuwhat/similar-text/blob/master/LICENSE |
|
9
|
|
|
* @Repository : https://github.com/manuwhat/similar |
|
10
|
|
|
* |
|
11
|
|
|
**/ |
|
12
|
|
|
namespace{ |
|
13
|
|
|
use EZAMA\similar_text; |
|
14
|
|
|
use EZAMA\commonTextSimilarities; |
|
15
|
|
|
|
|
16
|
|
|
function SimilarText( |
|
17
|
|
|
$firstString, |
|
18
|
|
|
$secondString, |
|
19
|
|
|
$round = 2, |
|
20
|
|
|
$insensitive = true, |
|
21
|
|
|
&$stats = false, |
|
22
|
|
|
$getParts = false, |
|
23
|
|
|
$checkposition=false |
|
24
|
|
|
) { |
|
25
|
|
|
return similar_text::similarText( |
|
26
|
|
|
$firstString, |
|
27
|
|
|
$secondString, |
|
28
|
|
|
$round, |
|
29
|
|
|
$insensitive, |
|
30
|
|
|
$stats, |
|
31
|
|
|
$getParts, |
|
32
|
|
|
$checkposition |
|
33
|
|
|
); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
function areAnagrams($a, $b) |
|
37
|
|
|
{ |
|
38
|
|
|
return commonTextSimilarities::areAnagrams($a, $b); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
function similarButNotEqual($a, $b) |
|
42
|
|
|
{ |
|
43
|
|
|
return commonTextSimilarities::similarButNotEqual($a, $b); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
function aIsSuperStringOfB($a, $b) |
|
47
|
|
|
{ |
|
48
|
|
|
return commonTextSimilarities::aIsSuperStringOfB($a, $b); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
function haveSameRoot($a, $b) |
|
52
|
|
|
{ |
|
53
|
|
|
return commonTextSimilarities::haveSameRoot($a, $b); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
function wordsReorderOccured($a, $b, $considerPunctuation=true) |
|
57
|
|
|
{ |
|
58
|
|
|
return commonTextSimilarities::wordsReorderOccured($a, $b, $considerPunctuation); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
function punctuactionChangesOccured($a, $b, $considerSpace=true) |
|
62
|
|
|
{ |
|
63
|
|
|
return commonTextSimilarities::punctuactionChangesOccured($a, $b, $considerSpace); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
function areStems($a, $b) |
|
67
|
|
|
{ |
|
68
|
|
|
return commonTextSimilarities::areStems($a, $b); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
function strippedUrl($a, $b) |
|
72
|
|
|
{ |
|
73
|
|
|
return commonTextSimilarities::strippedUrl($a, $b); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
function acronymOrExpanded($a, $b) |
|
77
|
|
|
{ |
|
78
|
|
|
return commonTextSimilarities::acronymOrExpanded($a, $b); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
function wordsAddedOrRemoved($a, $b) |
|
82
|
|
|
{ |
|
83
|
|
|
return commonTextSimilarities::wordsAddedOrRemoved($a, $b); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|