liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
liblevenshtein::distance::Distance Class Referenceabstract

Metric that measures the edit distance between two terms, denoted d(v,w). More...

#include <distance.h>

Inheritance diagram for liblevenshtein::distance::Distance:
Collaboration diagram for liblevenshtein::distance::Distance:

Public Member Functions

virtual auto between (std::string v, std::string w) -> std::size_t=0
 Measures the edit distance between two terms.
 
auto operator() (const std::string &v, const std::string &w) -> std::size_t
 Measures the edit distance between two terms.
 

Detailed Description

Metric that measures the edit distance between two terms, denoted d(v,w).

The edit distance is the minimum number of elementary operations required to transform one term into the other, but it does not describe a unique combination of transformations. Elementary operations consist of insertion, deletion, and substitution, and any others specific to each implementation.

A distance metric satisfies the following axioms:

  1. d(x, y) = 0, if x = y
  2. d(x, y) > 0, if x != y
  3. d(x, y) = d(y, x)
  4. d(x, z) <= d(x, y) + d(y, z)

Definition at line 21 of file distance.h.

Member Function Documentation

◆ between()

virtual auto liblevenshtein::distance::Distance::between ( std::string v,
std::string w ) -> std::size_t
pure virtual

Measures the edit distance between two terms.

Parameters
vFirst term to compare.
wSecond term to compare.
Returns
Edit distance between v and w.

Implemented in liblevenshtein::distance::MergeAndSplitDistance, liblevenshtein::distance::StandardDistance, and liblevenshtein::distance::TranspositionDistance.

◆ operator()()

auto liblevenshtein::distance::Distance::operator() ( const std::string & v,
const std::string & w ) -> std::size_t

Measures the edit distance between two terms.

This is equivalent to calling between(v, w).

Parameters
vFirst term to compare.
wSecond term to compare.
Returns
Edit distance between v and w.

Definition at line 5 of file distance.cpp.

6 {
7 return between(v, w);
8}
virtual auto between(std::string v, std::string w) -> std::size_t=0
Measures the edit distance between two terms.
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition main.cpp:25

References query().

Here is the call graph for this function:

The documentation for this class was generated from the following files: