Levenshtein - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


StringTools

  

Levenshtein

  

compute the Levenshtein distance between two strings

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Levenshtein( s, t )

Parameters

s

-

Maple string

t

-

Maple string

Description

• 

The Levenshtein( s, t ) command returns an integer measure of the distance between the two strings s and t.

• 

This distance measure is also known as the edit distance between the strings. It counts the number of edit operations of the following kinds needed to transform the first string into the second.

• 

There are three kinds of edit operations: insertions, deletions, and substitutions. The Levenshtein distance formula assigns each edit operation a weight equal to 1, and computes the length of the shortest sequence of edits needed to transform one string into the other.

• 

All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

useStringToolsinLevenshteinMathematics,Mathematischeend use

3

(1)

withStringTools:

Levenshteinabc,abd

1

(2)

Levenshteinabc,bca

2

(3)

Levenshteinbrad,angelina

8

(4)

LevenshteinRandom100,alnum,Random100,alnum

96

(5)

See Also

string

StringTools

StringTools[EditDistance]

StringTools[HammingDistance]