Levenshtein Distance

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Created page with " This function is an Advanced Text function in the UBot Extended Library. This function calculates levenshtein distance between two strings. '''First String:''' The first...")
 
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
  
This function is an [[Advanced Text]] function in the UBot Extended Library. This function calculates levenshtein distance between two strings.
+
This function is an [[Advanced Text]] function in the UBot Extended Library. This function calculates levenshtein distance between two strings (the number of deletions, insertions, or substitutions required to transform source string into target string.)
  
 
'''First String:''' The first string in the comparison.
 
'''First String:''' The first string in the comparison.
 +
 
'''Second String:''' The second string in the comparison.
 
'''Second String:''' The second string in the comparison.
  
== Example ==
+
To read more about the purpose of the levenshtein distance, [http://planetcalc.com/1721/|please see here].
 +
== Example 1 ==
 
<pre>
 
<pre>
  
Line 17: Line 19:
  
 
[[File:levdis.jpg]]
 
[[File:levdis.jpg]]
 +
 +
 +
== Example 2 ==
 +
<pre>
 +
 +
alert($levenshtein distance("rosettacode","raisethysword"))
 +
 +
</pre>
 +
 +
 +
Running the [[alert]] command will produce the levenshtein distance between the strings "rosettacode" and "raisethysword", which is 8.
 +
 +
 +
[[File:levdis1.jpg]]

Latest revision as of 16:09, 24 September 2016

This function is an Advanced Text function in the UBot Extended Library. This function calculates levenshtein distance between two strings (the number of deletions, insertions, or substitutions required to transform source string into target string.)

First String: The first string in the comparison.

Second String: The second string in the comparison.

To read more about the purpose of the levenshtein distance, see here.

[edit] Example 1


alert($levenshtein distance(300,900))


Running the alert command will produce the levenshtein distance between the numbers 300 and 900, which is 1.


Levdis.jpg


[edit] Example 2


alert($levenshtein distance("rosettacode","raisethysword"))


Running the alert command will produce the levenshtein distance between the strings "rosettacode" and "raisethysword", which is 8.


Levdis1.jpg

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox