[][src]Module triple_accel::levenshtein

This module provides many Levenshtein distance routines.

These distance functions share the same efficient underlying SIMD-accelerated implementation:

  • levenshtein_exp for low number of edits, otherwise levenshtein
  • rdamerau_exp for low number of edits, otherwise rdamerau
  • levenshtein_simd_k
  • levenshtein_simd_k_with_opts

These search functions share the same efficient underlying SIMD-accelerated implementation:

  • levenshtein_search
  • levenshtein_search_simd
  • levenshtein_search_simd_with_opts

Structs

EditCosts

A struct holding the edit costs for mismatches, gaps, and possibly transpositions.

Constants

LEVENSHTEIN_COSTS

Costs for Levenshtein distance, where mismatches and gaps both have a cost of 1, and transpositions are not allowed.

RDAMERAU_COSTS

Costs for restricted Damerau-Levenshtein distance, where mismatches, gaps, and transpositions all have a cost of 1.

Functions

levenshtein

Returns the Levenshtein distance between two strings using SIMD acceleration.

levenshtein_exp

Returns the Levenshtein distance between two strings using exponential search and SIMD acceleration.

levenshtein_naive

Returns the Levenshtein distance between two strings using the naive scalar algorithm.

levenshtein_naive_k

Returns the Levenshtein distance, bounded by a cost threshold k, between two strings, using the naive scalar algorithm.

levenshtein_naive_k_with_opts

Returns the Levenshtein distance, bounded by a cost threshold k, between two strings and optionally, the edit traceback, using the naive scalar algorithm, with extra options.

levenshtein_naive_with_opts

Returns the Levenshtein distance between two strings and optionally, the edit traceback, using the naive scalar algorithm, with extra options.

levenshtein_search

Returns an iterator over best Matchs by searching through the text haystack for the pattern needle using SIMD acceleration.

levenshtein_search_naive

Returns an iterator over the best Matchs by searching through the text haystack for the pattern needle using the naive algorithm.

levenshtein_search_naive_with_opts

Returns an iterator over Matchs by searching through the text haystack for the pattern needle using the naive algorithm, with extra options.

levenshtein_search_simd

Returns an iterator over the best Matchs by searching through the text haystack for the pattern needle using SIMD acceleration.

levenshtein_search_simd_with_opts

Returns an iterator over Matchs by searching through the text haystack for the pattern needle using SIMD acceleration, with extra options.

levenshtein_simd_k

Returns the Levenshtein distance, bounded by a cost threshold k, between two strings, using SIMD acceleration.

levenshtein_simd_k_with_opts

Returns the Levenshtein distance, bounded by a cost threshold k, between two strings and optionally, the edit traceback, using SIMD acceleration, with extra options.

rdamerau

Returns the restricted Damerau-Levenshtein distance between two strings using SIMD acceleration.

rdamerau_exp

Returns the restricted Damerau-Levenshtein distance between two strings using exponential search and SIMD acceleration.