forked from manuwhat/similar-text
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimilar_text.php
122 lines (100 loc) · 2.94 KB
/
similar_text.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
/**
*
* @Name : similar-text
* @Programmer : Akpé Aurelle Emmanuel Moïse Zinsou
* @Date : 2019-04-01
* @Released under : https://github.com/manuwhat/similar-text/blob/master/LICENSE
* @Repository : https://github.com/manuwhat/similar
*
**/
namespace{
use EZAMA\similar_text;
use EZAMA\simpleCommonTextSimilarities;
use EZAMA\complexCommonTextSimilaritiesHelper;
use EZAMA\complexCommonTextSimilarities;
use EZAMA\distance;
use EZAMA\diceDistance;
use EZAMA\levenshteinDistance;
use EZAMA\jaroWinklerDistance;
use EZAMA\hammingDistance;
function SimilarText(
$firstString,
$secondString,
$round = 2,
$insensitive = true,
&$stats = false,
$getParts = false,
$checkposition = false
) {
return similar_text::similarText(
$firstString,
$secondString,
$round,
$insensitive,
$stats,
$getParts,
$checkposition
);
}
function areAnagrams($a, $b)
{
return simpleCommonTextSimilarities::areAnagrams($a, $b);
}
function similarButNotEqual($a, $b)
{
return simpleCommonTextSimilarities::similarButNotEqual($a, $b);
}
function aIsSuperStringOfB($a, $b)
{
return simpleCommonTextSimilarities::aIsSuperStringOfB($a, $b);
}
function haveSameRoot($a, $b)
{
return simpleCommonTextSimilarities::haveSameRoot($a, $b);
}
function wordsReorderOccured($a, $b, $considerPunctuation = true)
{
return complexCommonTextSimilarities::wordsReorderOccured($a, $b, $considerPunctuation);
}
function punctuationChangesOccured($a, $b, $considerSpace = true)
{
return complexCommonTextSimilarities::punctuationChangesOccured($a, $b, $considerSpace);
}
function areStems($a, $b)
{
return complexCommonTextSimilarities::areStems($a, $b);
}
function strippedUrl($a, $b)
{
return complexCommonTextSimilarities::strippedUrl($a, $b);
}
function acronymOrExpanded($a, $b)
{
return complexCommonTextSimilarities::acronymOrExpanded($a, $b);
}
function wordsAddedOrRemoved($a, $b)
{
return complexCommonTextSimilarities::wordsAddedOrRemoved($a, $b);
}
function _levenshtein($a, $b)
{
return levenshteinDistance::levenshtein($a, $b);
}
function levenshteinDamerau($a, $b)
{
return levenshteinDistance::levenshteinDamerau($a, $b);
}
function dice($a, $b, $round = 2)
{
return diceDistance::dice($a, $b, $round);
}
function hamming($a, $b)
{
return hammingDistance::hamming($a, $b);
}
function jaroWinkler($a, $b, $round = 2)
{
return jaroWinklerDistance::jaroWinkler($a, $b, $round);
}
}