liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
|
Constructs a Levenshtein Transducer that, when given a dictionary automaton, query term, and maximum edit distance, n
, is able to match all spelling candidates in the dictionary automaton for the query term whose edit distances are no larger than n
.
More...
#include <transducer.h>
Public Member Functions | |
Transducer (DawgNode *root) | |
Constructs a Levenshtein Transducer around the root DawgNode of a Dawg dictionary. | |
~Transducer () | |
Frees any owned allocations. | |
auto | operator() (const std::string &term, std::size_t max_distance=2) -> LazyIterator< Result > |
Transduces the query term and max_distance into the set of all spelling candidates from the dictionary automaton whose edit distances from term are no greater than max_distance . | |
Private Attributes | |
Intersection * | _intersection |
Initial intersection between the Levenshtein automaton and dictionary automaton. | |
Constructs a Levenshtein Transducer that, when given a dictionary automaton, query term, and maximum edit distance, n
, is able to match all spelling candidates in the dictionary automaton for the query term whose edit distances are no larger than n
.
Definition at line 26 of file transducer.h.
liblevenshtein::Transducer< Type, Result >::Transducer | ( | DawgNode * | root | ) |
Constructs a Levenshtein Transducer around the root DawgNode of a Dawg dictionary.
Definition at line 14 of file transducer.cpp.
References query().
liblevenshtein::Transducer< Type, Result >::~Transducer | ( | ) |
Frees any owned allocations.
Definition at line 21 of file transducer.cpp.
auto liblevenshtein::Transducer< Type, Result >::operator() | ( | const std::string & | term, |
std::size_t | max_distance = 2 ) -> LazyIterator<Result> |
Transduces the query term
and max_distance
into the set of all spelling candidates from the dictionary automaton whose edit distances from term
are no greater than max_distance
.
term | Query term for spelling correction. |
max_distance | Maximum edit distance to consider when matching spelling candidates. |
term
are no greater than max_distance
. Definition at line 26 of file transducer.cpp.
References query().
|
private |
Initial intersection between the Levenshtein automaton and dictionary automaton.
Definition at line 61 of file transducer.h.