api/editdistance.h File Reference

Edit distance calculation algorithm. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int edit_distance_unsigned (const unsigned *ptr1, int len1, const unsigned *ptr2, int len2, int max_distance)
 Calculate the edit distance between two sequences.


Detailed Description

Edit distance calculation algorithm.

Definition in file editdistance.h.


Function Documentation

int edit_distance_unsigned ( const unsigned *  ptr1,
int  len1,
const unsigned *  ptr2,
int  len2,
int  max_distance 
)

Calculate the edit distance between two sequences.

Edit distance is defined as the minimum number of edit operations required to move from one sequence to another. The edit operations considered are:

  • Insertion of a character at an arbitrary position.
  • Deletion of a character at an arbitrary position.
  • Substitution of a character at an arbitrary position.
  • Transposition of two neighbouring characters at an arbitrary position in the string.

Parameters:
ptr1 A pointer to the start of the first sequence.
len1 The length of the first sequence.
ptr2 A pointer to the start of the second sequence.
len2 The length of the first sequence.
max_distance The greatest edit distance that's interesting to us. If the true edit distance is > max_distance, any value > max_distance may be returned instead (which allows the edit distance algorithm to avoid work for poor matces).
Returns:
The edit distance from one item to the other.

Definition at line 210 of file editdistance.cc.

Referenced by Xapian::Database::get_spelling_suggestion().


Documentation for Xapian (version 1.2.8).
Generated on 14 Dec 2011 by Doxygen 1.5.9.