<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/spell.levenshteinDistance.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>spell.levenshteinDistance</api:function-name><api:suggest>spell.levenshteindistance</api:suggest><api:suggest>spell</api:suggest><api:suggest>levenshteindistance</api:suggest><api:function-link mode="xquery" fullname="spell:levenshtein-distance">/apidoc/8.0/spell:levenshtein-distance.xml</api:function-link><api:function mode="javascript" name="levenshteinDistance" type="builtin" lib="spell" category="SpellBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="spell" namespace="http://marklogic.com/xdmp/spell" fullname="spell.levenshteinDistance"><api:summary>
  Given two strings, returns the Levenshtein distance between those strings.
  The Levenshtein distance is a measure of how many operations it takes to
  transform a string into another string, and it is useful in determining
  if a word is spelled correctly, or in simply comparing how "different" two
  words are.
</api:summary><api:params><api:param name="str1" type="xs:string"><api:param-description>
    The first input string.
  </api:param-description><api:param-name>str1</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="str2" type="xs:string"><api:param-description>
    The second input string.
  </api:param-description><api:param-name>str2</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>Number</api:return><api:usage>
   <p xmlns="http://www.w3.org/1999/xhtml">The <code>spell:levenshtein-distance</code> function is a built-in
   function and does not require the <code>import module</code> statement
   in the XQuery prolog.</p>
   <p xmlns="http://www.w3.org/1999/xhtml">The <code>spell:levenshtein-distance</code> function throws an exception
   if one of the strings is 64 or more characters in length and the other
   is at least 1 character in length.</p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
spell.levenshteinDistance("albatros","albetros");
  
=&gt; 1
</pre></api:example><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
spell.levenshteinDistance("cat", "cats");
  
=&gt; 1
</pre></api:example></api:function></api:function-page>