-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring-distance-funcs.html
More file actions
63 lines (61 loc) · 3.41 KB
/
string-distance-funcs.html
File metadata and controls
63 lines (61 loc) · 3.41 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>String Distance Functions - SQL Notebook</title>
<link rel="stylesheet" href="sqlnotebook.css">
</head>
<body>
<header>
<table class="nav">
<tr>
<td>
<a href="index.html"><img src="art/SqlNotebookIcon.png" alt="SQL Notebook (logo)" style="width: 58px; height: 58px; float: left; margin-right: 20px;"></a>
</td>
<td>
<a href="index.html" id="title">SQL Notebook</a><br>
<nav>
<ul class="nav">
<li><a href="https://github.com/brianluft/sqlnotebook/releases">Download</a></li>
<li><a href="doc.html"><span id="header-doc-long">Documentation</span><span id="header-doc-short">Docs</span></a></li>
<li><a href="https://github.com/brianluft/sqlnotebook">GitHub</a></li>
</ul>
</nav>
</td>
</tr>
</table>
<hr style="margin-top: 15px; margin-bottom: 15px;">
</header>
<article><div id="article">
<h1>String Distance Functions</h1>
<p>These functions provide standard algorithms for determining the similarity of two strings. They each accept two
strings as parameters and return a numeric score where a lower score indicates more similar strings. The specific
meaning of the numeric score depends on the algorithm. These functions support ASCII strings only; they will throw an
error if a string containing non-ASCII characters is provided. These functions are provided by the
<a moz-do-not-send="true" href="https://github.com/nalgeon/sqlean">sqlean "fuzzy"</a> extension which is built into
SQL Notebook.<br></p>
<h2>Syntax</h2><code>DLEVENSHTEIN(</code><code><code><i>x</i>, <i>y</i></code>) <i>--</i>
<i><a moz-do-not-send="true" href=
"https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance">Damerau-Levenshtein distance</a></i><br>
EDIT_DISTANCE(</code><code><code><i>x</i>, <i>y</i></code>) <i>--</i> <i><a moz-do-not-send="true" href=
"https://en.wikipedia.org/wiki/Edit_distance">Spellcheck edit distance</a></i><br>
HAMMING(</code><code><code><i>x</i>, <i>y</i></code>) <i>--</i>
<i><a moz-do-not-send="true" href="https://en.wikipedia.org/wiki/Hamming_distance">Hamming distance</a></i><br>
JARO_WINKLER(</code><code><code><i>x</i>, <i>y</i></code>) <i>--</i> <i><a moz-do-not-send="true" href=
"https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance">Jaro-Winkler distance</a></i><br>
LEVENSHTEIN(</code><code><code><i>x</i>, <i>y</i></code>) <i>--</i> <i><a moz-do-not-send="true" href=
"https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein distance</a></i><br>
OSA_DISTANCE(<i>x</i>, <i>y</i>) <i>--</i> <i><a moz-do-not-send="true" href=
"https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance#Optimal_string_alignment_distance">Optimal string
alignment distance</a></i><br></code>
<h2>Return Value</h2>Numeric string distance. The specific meaning depends on the algorithm.<br>
<h2>Example</h2>
<pre>PRINT LEVENSHTEIN('pickle', 'pickle'); <i>-- 0</i><br>PRINT LEVENSHTEIN('pickle', 'tickle'); <i>-- 1</i><br>PRINT LEVENSHTEIN('pickle', 'stick'); <i>-- 4</i><br>PRINT LEVENSHTEIN('pickle', '🙂stick'); <i>-- error: non-ASCII string</i><br></pre>
</div></article>
<footer><div id="footer">
<hr>
© 2016-2025 <a href="https://github.com/electroly">Brian Luft</a>
</div></footer>
</body>
</html>