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\simpleCommonTextSimilarities; |
15
|
|
|
use EZAMA\complexCommonTextSimilarities; |
16
|
|
|
|
17
|
|
|
function SimilarText( |
18
|
|
|
$firstString, |
19
|
|
|
$secondString, |
20
|
|
|
$round = 2, |
21
|
|
|
$insensitive = true, |
22
|
|
|
&$stats = false, |
23
|
|
|
$getParts = false, |
24
|
|
|
$checkposition = false |
25
|
|
|
) { |
26
|
|
|
return similar_text::similarText( |
27
|
|
|
$firstString, |
28
|
|
|
$secondString, |
29
|
|
|
$round, |
30
|
|
|
$insensitive, |
31
|
|
|
$stats, |
32
|
|
|
$getParts, |
33
|
|
|
$checkposition |
34
|
|
|
); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
function areAnagrams($a, $b) |
38
|
|
|
{ |
39
|
|
|
return simpleCommonTextSimilarities::areAnagrams($a, $b); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
function similarButNotEqual($a, $b) |
43
|
|
|
{ |
44
|
|
|
return simpleCommonTextSimilarities::similarButNotEqual($a, $b); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
function aIsSuperStringOfB($a, $b) |
48
|
|
|
{ |
49
|
|
|
return simpleCommonTextSimilarities::aIsSuperStringOfB($a, $b); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
function haveSameRoot($a, $b) |
53
|
|
|
{ |
54
|
|
|
return simpleCommonTextSimilarities::haveSameRoot($a, $b); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
function wordsReorderOccured($a, $b, $considerPunctuation = true) |
58
|
|
|
{ |
59
|
|
|
return simpleCommonTextSimilarities::wordsReorderOccured($a, $b, $considerPunctuation); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
function punctuationChangesOccured($a, $b, $considerSpace = true) |
63
|
|
|
{ |
64
|
|
|
return complexCommonTextSimilarities::punctuationChangesOccured($a, $b, $considerSpace); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
function areStems($a, $b) |
68
|
|
|
{ |
69
|
|
|
return complexCommonTextSimilarities::areStems($a, $b); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
function strippedUrl($a, $b) |
73
|
|
|
{ |
74
|
|
|
return complexCommonTextSimilarities::strippedUrl($a, $b); |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
function acronymOrExpanded($a, $b) |
78
|
|
|
{ |
79
|
|
|
return complexCommonTextSimilarities::acronymOrExpanded($a, $b); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
function wordsAddedOrRemoved($a, $b) |
83
|
|
|
{ |
84
|
|
|
return complexCommonTextSimilarities::wordsAddedOrRemoved($a, $b); |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|