Bulgaria PHP Conference 2016
Lyubomir Filipov * @FilipovG
Lyubomir Filipov
PHP Dev
Enthusiast
a, e, i, o, u, y, h, w.
Robert → R163
1. Robert → R
2. Robert → R1
3. Robert → R16
4. Robert → R163
a, e, i, o, u, y, h, w.
a, e, i, o, u, y, h, w.
Robert → R163
Rupert → R163
Rubin → R150
P | H | P | R | O | C | K | S |
---|
R | O | C | K | S |
---|
R | O | C | K | S |
---|
P | H | P | R | O | C | K | S |
---|
TEXT
PATTERN
Shifting direction
R | O | C | K | S |
---|
P | H | P | R | O | C | K | S |
---|
R | O | C | K | S |
---|
P | H | P | R | O | C | K | S |
---|
1 2 3 4
1 2 3 4
R | O | C | K | S |
---|
P | H | P | R | O | C | K | S |
---|
- difference between two sequences
transposition of two adjacent characters
D = 2
Levenshtein
D = 1
Damerau–Levenshtein
string soundex ( string $str )
int levenshtein ( string $str1 , string $str2 )
string metaphone ( string $str )
int similar_text ( string $first , string $second )
- list of dummy data (generated company names)
Array
(
[0] => _Agamba
[1] => gamba
[2] => _gamba
[3] => A_gamba
[4] => Aamba
[5] => A_amba
[6] => Ag_amba
[7] => Agmba
[8] => Ag_mba
[9] => Aga_mba
[10] => Agaba
[11] => Aga_ba
[12] => Agam_ba
[13] => Agama
[14] => Agam_a
[15] => Agamb_a
[16] => Agamb
[17] => Agamb_
[18] => Agamba_
)
We have made a typo in the company name 'Agimba'.
D = 1
3 * n - queries
SELECT
*
FROM
`companyList`
WHERE
`companyNames` LIKE '%_Agamba%'
OR `companyNames` LIKE '%gamba%'
OR `companyNames` LIKE '%_gamba%'
OR `companyNames` LIKE '%A_gamba%'
OR `companyNames` LIKE '%Aamba%'
OR `companyNames` LIKE '%A_amba%'
OR `companyNames` LIKE '%Ag_amba%'
OR `companyNames` LIKE '%Agmba%'
OR `companyNames` LIKE '%Ag_mba%'
OR `companyNames` LIKE '%Aga_mba%'
OR `companyNames` LIKE '%Agaba%'
OR `companyNames` LIKE '%Aga_ba%'
OR `companyNames` LIKE '%Agam_ba%'
OR `companyNames` LIKE '%Agama%'
OR `companyNames` LIKE '%Agam_a%'
OR `companyNames` LIKE '%Agamb_a%'
OR `companyNames` LIKE '%Agamb%'
OR `companyNames` LIKE '%Agamb_%'
OR `companyNames` LIKE '%Agamba_%';
15 results in 30 ms.
D = 1
3 * n - queries
http://suggestqueries.google.com/complete/search?output=toolbar&hl=en&q=ninaj
[
"ninaj",
[
"ninja",
"ninja turtles",
"ninja blender",
...
],
{
"google:suggestrelevance":[
1250,
601,
600,
],
...
}
]
http://suggestqueries.google.com/complete/search?output=toolbar&hl=bg&q=ниндж
output | Type of response you want. |
---|---|
hl | Language's 2-letter abbreviation |
q | Your search term. |
http://suggestqueries.google.com/complete/search?output=firefox&hl=bg&q=ниндж
["нинд",
["нинджаго","нинджа","нинджи",
"нинджаго господари на спинджицу",
"нинджаго песни",
"нинджаго майсторите на спинджицу",
"нинджаго сезон 7","нинджа убиец",
"нинджаго играчки","нинджа игри"]
]
Lyubomir Filipov * @FilipovG
https://joind.in/talk/88029