CBMC
|
Simple automaton that can detect whether a string can be transformed into another with a limited number of deletions, insertions or substitutions. More...
#include <edit_distance.h>
Public Member Functions | |
levenshtein_automatont (const std::string &string, std::size_t allowed_errors=2) | |
bool | matches (const std::string &string) const |
std::optional< std::size_t > | get_edit_distance (const std::string &string) const |
void | dump_automaton_dot_to (std::ostream &out) |
Private Types | |
using | state_labelt = nfat< char >::state_labelt |
Private Attributes | |
nfat< char > | nfa |
std::vector< state_labelt > | final_states |
Simple automaton that can detect whether a string can be transformed into another with a limited number of deletions, insertions or substitutions.
Not a very fast implementation, but should be good enough for small strings.
Definition at line 24 of file edit_distance.h.
|
private |
Definition at line 28 of file edit_distance.h.
levenshtein_automatont::levenshtein_automatont | ( | const std::string & | string, |
std::size_t | allowed_errors = 2 |
||
) |
Definition at line 8 of file edit_distance.cpp.
|
inline |
Definition at line 39 of file edit_distance.h.
std::optional< std::size_t > levenshtein_automatont::get_edit_distance | ( | const std::string & | string | ) | const |
Definition at line 58 of file edit_distance.cpp.
bool levenshtein_automatont::matches | ( | const std::string & | string | ) | const |
Definition at line 52 of file edit_distance.cpp.
|
private |
Definition at line 29 of file edit_distance.h.
|
private |
Definition at line 27 of file edit_distance.h.